I am trying to redirect my domain to a new document root if a cookie value is something. I did setup the rewrite and it works fine.
RewriteLog "/home/user/dev/logs/rewrite.log"
RewriteLogLevel 3
RewriteCond %{HTTP_COOKIE} !^new_layout_v1_dev$
RewriteCond $1 !^php5.fastcgi [NC]
RewriteRule ^/(.*)$ /home/user/dev/user.dev/htdocs/$1 [C]
The problem I have is that the site has a rewrite.conf
configuration file to rewrite SEO friendly URL's. When the document root redirect does redirect me to a new document root then it does not load the next rewrite's or the config in the new document root.
Errors:
The requested URL /testime-pilte-2655600.html was not found on this server.
As we use SEO friendly URLs in our webapp and redirect them via rewrite rules to the right php file, then when rewrite.conf
is not loaded, the web page will show not found
error.
So my question is, how could I make document root rewrite work so that it will load the new document root rewrite config as well.
If
rewrite.conf
is being included in a<Directory>
tag or has its rewrites contained within a<Directory>
tag, try moving it out of that and just residing at the VirtualHost level.These are the rewrites I ended up with and they work: