Forum Moderators: phranque
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^(.*)CATALOG/(.*)$ $1/CATALOG.php?item=$2
RewriteRule ^(.*)catalog/(.*)$ $1/CATALOG.php?item=$2
RewriteRule UnknownError UnknownError.php
RewriteCond %{HTTP_HOST}!^www\.widget\.com
RewriteRule .* [widget.com...] [R=301,L]
IndexIgnore *
ErrorDocument 400 /error.php?code=400
ErrorDocument 401 /error.php?code=401
ErrorDocument 403 /error.php?code=403
ErrorDocument 404 /error.php?code=404
ErrorDocument 405 /error.php?code=405
ErrorDocument 406 /error.php?code=406
ErrorDocument 412 /error.php?code=412
ErrorDocument 414 /error.php?code=414
ErrorDocument 500 /error.php?code=500
ErrorDocument 501 /error.php?code=501
DirectoryIndex index.php
************************************
Now if I type domain.com, it is redirect to [domain.com...] note TWO // at the end of the URL. Similarly, if I type [domain.com...] it also becomes [domain.com...] (again note two //).
Can someone suggest what am I doing wrong?
Two additional question:
1. What does [R=301,L] mean?
2. I have seen [NC] in some examples, but I am not using it because it was not mentioned in jim's example.. should I be using it?
Thanks
SD
%{REQUEST_URI} will contain a leading slash. Since you also have a trailing slash in your substitution URL, you end up with two -- one from your substitution followed immediately by another in %{REQUEST_URI}.
For the other questions, I would suggest taking a look at the documentation.
Apache mod_rewrite documentation [httpd.apache.org]
Apache URL Rewriting Guide [httpd.apache.org]
Regular Expressions Tutorial [etext.lib.virginia.edu]
Jim
Thanks for the pointers. So are you suggesting that I cahnge it to read like this?
RewriteRule .* [widget.com%{REQUEST_URI}...] [R=301,L]
I have copied the exact syntax what you had posted in the original thread, then why is this extra "/" is not a problem for anyone else? Can you please suggest me what is unique in my htaccess setting.
Also, I read the three links you mentioned, I stilll could not find what is "L" in [R=301,L].
Thanks a lot!
SD
I still could not find what is "L" in [R=301,L]
In the mod_rewrite documentation, under the RewriteRule [httpd.apache.org] area, you will find the last rule flag and it's description.