Forum Moderators: phranque
I have osCommerce website installed in directory /ceske-slovenske-potraviny/
and because I have two domains .com and .co.uk I wanted to to use RewriteCond to handle redirects.
So I want all request (even www) to go to subdirectory of main domain example.co.uk/ceske-slovenske-potraviny/
The RewriteCond I come up with seem to work okay, but the problem is with password protected directory example.co.uk/ceske-slovenske-potraviny/protected/
When RewriteCond is in place and I try to access protected directory Iam redirected to page about cookies (which in fact replace 401 page).
my .htaccess (in root)
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^.*$ [NC]
RewriteRule ^(.*)$ http://example.co.uk/ceske-slovenske-potraviny/$1 [L,R=301]
I have tried RewriteOptions inherit mentioned in other topic, bus this doesnt work.
(trailing slash at the end also daesnt helped)
Any ideas please?
Thank you
[edited by: jdMorgan at 10:32 pm (utc) on Aug. 31, 2007]
[edit reason] example.co.uk [/edit]
It looks like your real problem is that you have coded an infinite loop, because there is nothing to stop the rewrite from executing recursively.
Try this, which will stop recursion:
Options +FollowSymLinks
RewriteEngine on
#
# If not already rewritten to subdirectory
RewriteCond %{REQUEST_URI} !^/ceske-slovenske-potraviny/
# rewrite all requests to the c-s-p subdirectory
RewriteRule (.*) http://example.co.uk/ceske-slovenske-potraviny/$1 [L,R=301]
ErrorDocument 500 /my_server_error_document.html
Also, please do not post your own domain name unless you would like this thread to outrank your own site in searches for for your domain! Use example.com or example.co.uk
Jim
this is output from header check:
HTTP/1.1 301 Moved Permanently =>
Date => Fri, 31 Aug 2007 23:28:07 GMT
Server => Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a
WWW-Authenticate => Basic realm="Halusky Admin"
Location => http://example.com/ceske-slovenske-potraviny/401.shtml
Connection => close
Content-Type => text/html; charset=iso-8859-1