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
-
What damage can internal duplicated hidden links do to rankings?
Hi, I have a rental website, www.akilar.com, for Spain. My question is, on the home page we have links to the seperate regions of the country. Somehow in the redesign of the site, these links have been placed on every page of the site and hidden in the code at the top. The links are there as well on each page in the header, these are additional. The page quantity is over 2000 pages. Also this is taking the internal links well over the limit. In anyones opinion what damage has this caused as our rankings of late have fallen. Thanks very much for your help!
Technical SEO | | AkilarOffice0 -
Oh no googlebot can not access my robots.txt file
I just receive a n error message from google webmaster Wonder it was something to do with Yoast plugin. Could somebody help me with troubleshooting this? Here's original message Over the last 24 hours, Googlebot encountered 189 errors while attempting to access your robots.txt. To ensure that we didn't crawl any pages listed in that file, we postponed our crawl. Your site's overall robots.txt error rate is 100.0%. Recommended action If the site error rate is 100%: Using a web browser, attempt to access http://www.soobumimphotography.com//robots.txt. If you are able to access it from your browser, then your site may be configured to deny access to googlebot. Check the configuration of your firewall and site to ensure that you are not denying access to googlebot. If your robots.txt is a static page, verify that your web service has proper permissions to access the file. If your robots.txt is dynamically generated, verify that the scripts that generate the robots.txt are properly configured and have permission to run. Check the logs for your website to see if your scripts are failing, and if so attempt to diagnose the cause of the failure. If the site error rate is less than 100%: Using Webmaster Tools, find a day with a high error rate and examine the logs for your web server for that day. Look for errors accessing robots.txt in the logs for that day and fix the causes of those errors. The most likely explanation is that your site is overloaded. Contact your hosting provider and discuss reconfiguring your web server or adding more resources to your website. After you think you've fixed the problem, use Fetch as Google to fetch http://www.soobumimphotography.com//robots.txt to verify that Googlebot can properly access your site.
Technical SEO | | BistosAmerica0 -
Can you recommend a Web Developer who specializes in SEO?
We are an e-commerce site, http://www.ccisolutions.com running on an obscure Web store coded for us by a small company called Assist, located in Utah. We believe we have numerous problems with our code that are negatively impacting our SEO. One such problem, the current meta refresh on our homepage, is in the process of being fixed (Thanks to Jenn Lopez at SEOMoz for helping me convince management it was important enough to pay the $ for the fix!). However, I believe there could be numerous other issues. I am the SEO strategist, but I am not a coder beyond basic HTML and CSS. Can anyone recommend a highly qualified Web developer who's strong in SEO that we might hire to do an audit of our code, including recommendations on how to fix anything that might be discovered as a problem?
Technical SEO | | danatanseo0 -
Please advice needed SSL .htaccess
Hi everyone, I recently installed verisign ssl. the idea to have page https://example.com all redirect from non-http to https work properly, but in IE whenever smbdy types https://www.example.com it shows the red screen with invalid certificate. If you click "proceed" - everything goes to normal page and on server redirect www to non-www seem to work fine. Is there way to get rid of the warning? Is it server or certificate issue? Here is the peice of code from htaccess. Please, advice needed! RewriteEngine On RewriteBase /RewriteCond %{HTTPS} !=on RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L] RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] Thanks in advance
Technical SEO | | Kotkov0 -
Can a site be removed from alexa?
let's say you have complete control over the webserver, and the hosting server. is there a way to set it up so that alexa statistics CANNOT be gained?
Technical SEO | | highersourcesites0 -
Can I redirect when Google is showing these as 2 different pages?
Hi Guys, Google webmaster is showing 1000 duplicate title tags because its picking up our pages like this. How can I correct this? Please explain in detail please. Thank You Tim /store/ICICLES_NO_7_CLEAR_WITH_PINK_NUBBY//store/ICICLES_NO_7_CLEAR_WITH_PINK_NUBBY
Technical SEO | | fasctimseo0 -
Browser Pop Ups - Can it be SEO Friendly and how?
Hi The designer of the company I work for is re-designing Pop Up browsers as well as inline Pop up and Drop down menus. He needs SEO requirements - how can they be SEO friendly? Thanks a lot for your help! SL. Please see below the detail: Browser Pop Ups all include:
Technical SEO | | charsimona
• a browser title,
• a logo and title in the title bar,
• a close window button and
• a call to action (that closes pop-up when clicked). Usage:
Use when you'd like to offer additional information to the
user but, not take the user away from the main page. Inline Pop up and Drop down menus. The inline pop-up & drop down is used to display additional menu options, functionality
or content on the page without dedicating real estate in the page layout. It's a part of the page HTML to retain SEO value and thus does not trigger pop-up blockers. A title bar displays when content of the pop-up or drop down is not in context of
the trigger. When used as a drop down, it is attached to the the bottom of it's trigger and left-aligned (unless it would exceed beyond the browser chrome, then it's right-aligned). When used as a pop-up, it is centered vertically/horizontally in the users browser window.
The inline pop-up/drop down can be triggered differently per instance (e.g. onclick, onhover with delay). It can be closed by: clicking on link/location that triggered the pop-up/drop down (a.k.a. close icon) clicking anywhere outside the pop-up/drop down There are 5 widths to choose from, based on the needs of the content: 196px (3 columns) 266px (4 columns) 406px (6 columns) 546px (8 columns) 658px (10 columns)0 -
Can I noindex most of my site?
A large number of the pages on my site are pages that contain things like photos and maps that are useful to my visitors, but would make poor landing pages and have very little written content. My site is huge. Would it be benificial to noindex all of these?
Technical SEO | | mascotmike0