Forum Moderators: phranque
RewriteCond %{HTTP_HOST} something.com
RewriteCond %{REQUEST_URI}!something/
RewriteRule ^(.*)$ something/test.php [L]
This correctly rewrites everything to test.php so I can read the url directly and process it internally. I've tried to but the exceptions into the regex as follows, but it dosen't work:
RewriteRule ^/(?!art\/¦stats\/)(.*)$ something/test.php [L]
I'd normally do this in the conf with an AliasMatch, but I don't have access to the conf for one of my sites hosted on an external server.
AliasMatch ^/(?!art\/¦stats\/)(.*) /home/something/public_html/test.php
Any ideas how I can use the rewrite statements above to accomplish this? Thanx
RewriteCond %{HTTP_HOST} something\.com
RewriteCond %{REQUEST_URI} !/(something¦art存tats)/
RewriteRule ^(.*)$ /something/test.php [L]
RewriteCond %{HTTP_HOST} something\.com
RewriteRule !^(something¦art¦stats)/ /something/test.php [L]
Jim
RewriteCond %{HTTP_HOST} something\.com
RewriteCond %{REQUEST_URI}!something/
RewriteRule!^(art存tats)/(.*)$ something/test.php [S=1]
RewriteRule ^(.*)$ something/$1 [L]
This generates and internal server error when I use the 2 rewrite rules together. The rules work fine when run alone but fail together. This is supposed to route everything that is in /(art存tat)/* to /something/(art存tats)/* and everyting else to /something/test.php. What am I missing?
# Rewrite all requests for something.com, except for subirs /something, /art, and /stats to /something/test.php
RewriteCond %{HTTP_HOST} something\.com
RewriteCond %{REQUEST_URI} !^/(something地rt存tats)/
RewriteRule .* /something/test.php [L]
# Rewrite /art and /stats to /something/art or /something/stats
RewriteCond %{HTTP_HOST} something\.com
RewriteCond %{REQUEST_URI} !^/something/
RewriteRule (.*) /something/$1 [L]
# Rewrite something.com/art<anything> and something.com/stats<anything> to
# something.com/something/art<anything> and something.com/something/stats<anything>, respectively
RewriteCond %{HTTP_HOST} something\.com
RewriteCond %{REQUEST_URI} !^/something/
RewriteRule ^((art存tats).*) /something/$1 [L]
# Rewrite all other resources requested from something.com to something.com/something/test.php
RewriteCond %{HTTP_HOST} something\.com
RewriteCond %{REQUEST_URI} !^/something/
RewriteRule .* /something/test.php [L]
# If requested domain is not something.com, or if /something/ subdirectory is requested, skip next 2 rules.
RewriteCond %{HTTP_HOST} !something\.com [OR]
RewriteCond %{REQUEST_URI} ^/something/
RewriteRule .* - [S=2]
# Else rewrite something.com/art<anything> and something.com/stats<anything> to
# something.com/something/art<anything> and something.com/something/stats<anything>, respectively
RewriteRule ^((art存tats).*) /something/$1 [L]
# Else rewrite all other resources requested from something.com to something.com/something/test.php
RewriteRule .* /something/test.php [L]
All of the above examples should be functionally identical; They differ primarily in 'style' and one or the other may be better for your site in terms of expandibility and/or maintainability.
Jim