Can someone interpret this entry in my htaccess file into english so that I can understand?
-
There are a number of entries in my htaccess and I'd like to understand what they are doing so that I can understand if they need to be there or not.
So, can someone tell me what this says...in plain english?
RewriteCond %{HTTP_HOST} ^legacytravel.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.legacytravel.com$
RewriteRule ^carrollton-travel-agent$ "http://www.legacytravel.com/carrollton-travel-agent" [R=301,L]Thank you a million times in advance.
-
Hello, my old htaccess buddy!
Let's say, perhaps, that a person wanted to change her main company blog from www.legacytravel.com/ramblings to www.legacytravel.com/blog.
Of course, all of the traffic would need to be re-directed. the htaccess currently says:
BEGIN WordPress
<ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /ramblings/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /ramblings/index.php [L]</ifmodule>END WordPress
Would it be appropriate / effective to add something there that directs everything in light of the renaming of that subfolder?
Again, thank you in advance.
-
Yep. Of course, as with any change, back the old rules up into a text file before making the move... just in case it explodes everything (but it won't). Just a precaution.
-
Alright, so if I take out all of the other nonsense...and just put this in...will that just make it go from legacytravel.com to www.legacytravel.com?
and that's that?
-
Sorry to disappoint, Travis. Nothing too complicated, looks like it was just a botched www cleanup. A good old:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^legacytravel.com [NC]
RewriteRule ^(.*)$ http://www.legacytravel.com/$1 [L,R=301]Will do the trick.
-
It doesn't force www in any instance. That's why I'm looking forward to the solution.
-
Hi,
That line of htaccess says:
If the host is legacytravel.com OR www.legacytravel.com, then lets try this rule below.
One conditions will always be true since the htaccess is on your site. So they cancel each other out, and are not needed.
The rule says if the URI matches the regular expression '^carrollton-travel-agent$' then redirect (r=301) to the target URL and stop processing rules (L flag for last)
Your RewriteRule target doesn't need characters escaping because it is not a regular expression, just a URL to redirect to. You also don't need the quotes, they're useful for grouping arguments with spaces in them but that's not affecting it.
Really this rewriterule doesn't accomplish anything, it redirects /carrollton-travel-agent to /carrollton-travel-agent, forcing the www. no matter which version is accessed. But if that is what you're wishing to achieve then there's a much simpler solution:
RewriteCond %{HTTP_HOST} !^www.legacytravel.com$ [NC]
RewriteRule ^(.*)$ http://www.legacytravel.com/$1 [R=301,L]
Notice we only use the \backslash to escape characters in regex patterns, and not in our target URL. What that rule will do is redirect any visitor where the host is missing the www to the equivalent page with the preceding www.
Hope that helps.
-
Would like to hear the resolution, given my endorsement.
-
Escaping characters isn't a big deal with newer version of Apache. No need for all those slashes, unless it's something more complex. From what I've seen, at least.
-
You got it.
Again, thank you so much for taking a look.
-
Alright... just give me a day or two since you don't have me on retainer
-
Alright...I just sent the whole redirect portion of the htaccess file to WilliamKammer.
Thank you so much, everyone, for your help.
-
I'm guessing you want to escape regex characters with a ? XD I just want to say again, that regex101 is a good resource. So thanks for sharing that.
-
I'm determined to master htaccess and regex... feel free to pm me the file
-
William may well be correct. I'm far from a Joomla! expert, I generally fix Joomla! problems by migrating to WordPress, so I don't know how that framework/CMS handles redirects. I'm not exactly criticizing Joomla!, but these things shouldn't be a problem. (Redirects are generally handled on the server level, I just don't know about Joomla!.)
This sounds like it's been around for a while, so it might not be a DNS issue, but keep that in your possible bucket.
Would you give one of us the entire .htaccess file via PM? I would prefer William, because he does these things for free all the time. Alternately, you can check it out yourself with http://htaccess.madewithlove.be/.
It's really funny though. I must have driven by your place a number of times. I used to live on Preston, about a mile away. It's Grapevine for me, these days. The place is a little more my speed.
-
It looks like the rule is attempting to rewrite www.legacytravel.com and legacytravel.com to legacytravel.com/carrollton-travel-agent, but it's not working. This is likely due to the piece on line 3 before the final URL (unless the person was attempting something else I'm not familiar with). Others issues could be the rewrite engine not being turned on, the .htaccess file being in the wrong place, or some other issue, like server settings.
-
The first two lines are the condition. It is saying if anyone comes to legacytravel.com or www.legacytravel.com then it is looking for this string carrollton-travel-agent if that string is found, then it will rewrite the url to http:\www.legacytravel.com/carrollton-travel-agent I don't really know why that rule is in place, but I am not familiar with the site.
You can learn about what the symbols in the htaccess mean here, http://perishablepress.com/stupid-htaccess-tricks/
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
How to no index / no follow CAD files .dxf .dwg
Hi, I have a new Wordpress site with a number of CAD files (.dxf& .dwg) downloadable straight from the site. These have been flagged in MOZ as warnings with everying from No Title/Description to duplicate content. Does anybody now how I would no index these type of files? Many thanks.
Technical SEO | | Jon_Pearce0 -
Website in English targeting different countries - is it worth investing in .com?
Hi, I was wondering... Let's say there is a company in Norway and It sell tours in Norway. Website is only in english, content stays exactly the same for each country (as the website is for people looking for tours in Norway). The domain is registered with .no ccTLD. Main target is USA, Canada and Uk and couple of other countries in Europe. Would the website benefit from having .com instead of .no? Thanks!
Technical SEO | | LeszekNowakowski0 -
Is having no robots.txt file the same as having one and allowing all agents?
The site I am working on currently has no robots.txt file. However, I have just uploaded a sitemap and would like to point the robots.txt file to it. Once I upload the robots.txt file, if I allow access to all agents, is this the same as when the site had no robots.txt file at all; do I need to specify crawler access on can the robots.txt file just contain the link to the sitemap?
Technical SEO | | pugh0 -
Pointing a sub-domain to a sub-folder in htaccess
I have a client who currently uses shopify for there blog. I want to set them up with a separate blog away from the shopify system and host it in Australia. I know the best option is using a subfolder but as the shopify system is an unmoveable CMS can I somehow point my subdomain to a subfolder and get the benefits of the domain name? I could do this by using the rewrite rule in the htaccess file. If I was to do this would it end up cloaking the URL's of the articles?
Technical SEO | | acs1110 -
How can I perform this 301 redirect?
I am working on a site for a colleague and have installed wordpress on their server in the wp directory, they want the root domain redirecting to the wp directory but everything i have tried seems to throw up errors. i need sample.co.uk to redirect to sample.co.uk/wp/ no matter which html file they are trying to access on the root of the sample.co.uk site help?
Technical SEO | | GrassRootsSEO0 -
Can these Yoast SEO integration issued be solved?
I had a site analysis done by the Yoast team. Of course, one of their recommendations was to install the Yoast SEO product. I see that there are many independent sources highly recommending it. But my programming is coming back with some concerns. My website is www.heartspm.com, for anyone who is interested in further analysis of my issue. My programmer's notes follow. Unfortunately, they are a bit to cryptic: "1. it does not do all for us anyway, so we'd have to keep the one's I made
Technical SEO | | GerryWeitz
before anyway, at least partially, but it will add up to complexety, loading
time as all new, and especially one-size-fits all plugins 2. another problem - Simple Press forum. Yoast does not have an extention for it, nor is it going to work along with our existing forum's SEO handling solution. So, it's
either reverting back to original SEO handling or forgetting Yoast. 3. original handling means no meta description although I think Yoast will put just
one description for each page, and title will be something like "<forum <br="">title> - <topic title="">whatever else you may want" 4. the same thing with XML sitemap 5. we won't be able to use Yoast's because it won't handle cities 6. and hopefully it will work with our existing XML sitemap solution as this can be turned off" Now, The Yoast team admitted and logically said that the Yoast plugin cannot support another plugin and therefore it does not support forums. We currently integrate the forum into our Wordpress site and perhaps imperfectly, but we are able to append forum links to the xml sitemap. Do any of you have insight into how one incorporates a forum into a Wordpress blog while using Yoast SEO?</topic></forum> We have special parameter based handling of cities. We used to pass codes like city=?zip and the like. Now, the URLS are very clean looking, but they use templates to match up cities in a city table with content that is somewhat similar, yet customizable. So my programmer seems to be saying that the Yoast tool doesn't seem to handle templates well or is not able to interpret it and get it into a sitemap. Do any of you have insight into using Yoast SEO with Wordpress sites that use templates and variables for locals or something of a similar nature? The Yoast SEO module also has switches to help resolve issues with duplicate content and archives and authors and multiple pages, i.e. page 1-10 of Latest News. If I can't use the whole Yoast module, are there ways to use only parts of it or to strip it down to what I want? Do you think with the above considerations, that the Yoast SEO module is not worth the trouble? Thanks in advance, Humbly, Gerry0 -
UK and US subdomain. Can both rank for some keyword terms?
One of my clients has one root domain http://www.website.com and there are two versions, the US and the UK. So there are two subdomains uk.website.com and us.website.com. Both subdomains contain similar content/landing pages and are going after the same keywords. One site is supposedly crawled by UK crawlers but still shows up in US-based SERPS. Will Google take into account that both subdomains are going for the same keyword terms and only rank one of them? How is this kind of thing handled?
Technical SEO | | C-Style0 -
Where can I find a good definition of "link juice"?
I have heard the term link juice being used in many different contexts. Where can I find a good definition for it?
Technical SEO | | casper4340