Forum Moderators: phranque
RewriteRule ^subdirectory$ subdirectory$1/ [R] #add trailing slash
RewriteRule ^subdirectory/(.*) /$1?subdirectory [NC]
I would also like to automatically send certain user agents to this virtual subdirectory. Something like this:
RewriteCond %{HTTP_USER_AGENT} ^useragent1 [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^useragent2 [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^useragent3 [NC]
RewriteRule ^(.*)$ /subdirectory/$1 [L]
Of course, this doesn't work, it results in a loop that errors out.
Help!
...
RewriteCond %{HTTP_USER_AGENT} ^useragent3 [NC]
[i]RewriteCond %{REQUEST_URI} !^/subdirectory/[/i]
RewriteRule ^(.*)$ /subdirectory/$1 [L]
Jim
When I add in:
RewriteCond %{HTTP_USER_AGENT} ^useragent3 [NC]
RewriteCond %{REQUEST_URI}!^/subdirectory/
RewriteRule ^(.*)$ /subdirectory/$1 [L]
And then request a page using "useragent3", my browser just hangs. I'm watching the HTTP headers and there's no network traffic (like in a redirect loop) and I never get a server error, the page just sits there like it's loading, but nothing ever comes up. When I comment out the three lines above, things return to normal.