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
-
Can you force Google to use meta description?
Is it possible to force Google to use only the Meta description put in place for a page and not gather additional text from the page?
Technical SEO | | A_Q0 -
How can I stop google indexing an image
I have put a map of cornwall on my site on the Corwnall Page, and for some reason Google.de has picked it up and shows it up in the top 4 images for a search for cornwall? The result is I am getting about 80% of the traffic coming to my site for the search Cornwall (I get about 50 unique visits per day, over 40 a day are landing on the Cornwall page. Is this a problem for my normal SEO as a Close up Magician? Will google start to think my site is about Cornwall? Should I noindex the image (I say that like I know how! - How do I noindex that image? ) Or is any traffic to a site good traffic, I imagine they will be clicking on the link landing on the page and then leaving, which I suspect is not good for google reputation. Any thoughts anyone Thanks Roger http://www.rogerlapin.co.uk Where they land http://www.google.de/imgres?imgurl=http://www.rogerlapin.co.uk/wp-content/uploads/2013/09/map-of-cornwall.jpg&imgrefurl=http://www.rogerlapin.co.uk/magician-cornwall-magicians-hire-cornwall&h=904&w=1000&sz=167&tbnid=9GFlDv3BTz4ikM:&tbnh=99&tbnw=110&zoom=1&usg=__-b4bUYWREU_wAy2M04LrsrkzZpw=&docid=AUFmzso0arbGDM&sa=X&ei=HLZ2UpGYDMrY0QWXp4D4Dg&ved=0CEgQ9QEwAw&dur=2958
Technical SEO | | rnperki0 -
What can i do to move my site up the search engines
Hi. my site www.in2town.co.uk is currently number five in google for the search word lifestyle magazine, sometimes it moves to four but for over a year it has not got past four. before we had to do the site from scratch due to a major problem upgrading, we were number one in the search engines and our traffic was around 30% higher than it is now. For the keyword lifestyle news, we are on the fifth page of google and would really like to improve this. I would like to know what i need to do on our home page to try and improve our rankings for these two words. the most important word for us is lifestyle news. any help in my goal to improve our rankings would be great. We have improved our design which we are still working on, and we have upgraded to a bigger dedicated server to improve the speed.
Technical SEO | | ClaireH-1848860 -
Looking for someone to help get reconsidered in Google search.
Hi Guys, I need some extra hands and recently got some notifications from Google about unnatural links and this is something I've known about already. I've tried a few times to email webmasters but there is little to no results. I'm looking for some individuals that are great at getting reconsidered to Google. The site I am working on already is being ranked but this is a partial ban. Please PM me your rates and success with previous campaigns. Ideally, I want a flat rate for 100% guarantee reconsideration. TIA!
Technical SEO | | William.Lau0 -
Can you 404 any forms of URL?
Hi seomozzers, <colgroup><col width="548"></colgroup>
Technical SEO | | Ideas-Money-Art
| http://ex.com/user/login?destination=comment%2Freply%2F256%23comment-form |
| http://ex.com/user/login?destination=comment%2Freply%2F258%23comment-form |
| http://ex.com/user/login?destination=comment%2Freply%2F242%23comment-form |
| http://ex.com/user/login?destination=comment%2Freply%2F257%23comment-form |
| http://ex.com/user/login?destination=comment%2Freply%2F260%23comment-form |
| http://ex.com/user/login?destination=comment%2Freply%2F225%23comment-form |
| http://ex.com/user/login?destination=comment%2Freply%2F251%23comment-form |
| http://ex.com/user/login?destination=comment%2Freply%2F176%23comment-form | These are duplicate content and the canonical version is: http://www.ex.com/user (login and pass page of the website) Since there were multiple other duplicates which mostly have been resolved by 301s, I figured that all "LOGIN" URLs (above) should be 404d since they don't carry any authority and 301 those wouldn't be the best solution since "too many 301s" can slow down the website speed. But a member of the dev team said: "Looks like all the urls requested to '404 redirect' are actually the same page http://ex.com/user/login. The only part of the url that changes is the variables after the "?" . I don't think you can (or highly not recommended) make 404 pages display for variables in a url. " So my question is: I am not sure what he means by that? and Is it really better to not 404 these? Thanks0 -
What are the 5 most important things that a novice blogger can do to improve Moz Rank
I have been blogging for sometime now.Around 50 days to be specific. The best part is in these 50 days is I have been able to Monitor and improve my Alexa rank for above 19 million to below 400 thousand now and its still improving.More so,my country rank has improved quite drastically,its now among the first 20 thousand websites in India. However,I have noticed these things in particular - 1.Mozrank has been constant at 1.5, all this while. 2.The Root domain authority improved by just 1 point to 96,as I am using blogger platform. 3.The mozTrust has been 0 all this while too. I don't understand how to tackle these issues.As I am already featured in couple of websites among the top ranked blogs from India.I have kept my eye on the moz Rank now for quite sometime. Hence this obvious question.In my situation what are the 5 most important things a blogger can do to improve the ranking. I am targeting the bracket of 2-3 for the coming month ranking. Thank you beforehand. Much Regards Amit Ganguly Promote Green .. Promote Sustainability ..
Technical SEO | | amit.ganguly0 -
Can I reduce link count by no following links?
Hi, A large number of my pages contain over 100 links. This is due to a large drop down navigation which is on every page. To reduce my link count could I just no follow these navigation links or would I have to remove the navigation completely?
Technical SEO | | moesian0 -
Can someone break down 'page level link metrics' for me?
Sorry for the, again, basic question - can someone define page level link metrics for me?
Technical SEO | | Benj250