![]() |
htaccess code clarification
I have the following code in my htaccess (but with my actual domain name of course), and I'm not sure if I understand exactly what it is all for....I was just wondering if someone could help explain precisely what this means.
#if the domain is not www.mydomain.com RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ [NC] #redirect to www.mydomain.com RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301] #leave this rule in place, but after the one above to handle the home page RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/ RewriteRule ^(.*)index\.html$ http://www.mydomain.com/$1 [R=301,L] |
Quote:
Example: Code:
mydomain.com -> www.mydomain.comR=301 => 301 redirect L => Last condition[/CODE] Quote:
For example: Code:
www.mydomain.com/TEST/index.html -> www.mydomain.com/TEST/For more details: http://www.ganeshbabujayaraman.com/a...and-drupal-cms |
I was wondering if it is necessary to keep all of this code in my htaccess....because I have www.mydomain.com set as my hard canonical name, which I think is supposed to redirect aliases such as mydomain.com automatically (without having to code anything in htacess). However, I don't think this has anything to do with redirecting index.html to the non-index.html url. Would it make sense to take out the first part:
Code:
#if the domain is not www.mydomain.comCode:
#leave this rule in place, but after the one above to handle the home page |
Rewrite rules don't actually "hide" URLs, they just change them. In order to have a dynamic value be passed to the script it must be visible in the URL. You could, however, use a rewrite rule to add a static GET parameter to a URL that doesn't have one or to convert a visible part of the URL into a GET parameter.
|
| All times are GMT +1. The time now is 07:50 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.