Forum Moderators: phranque
So:
tld.example.com/dir - would be let through
tld.example.com/css/styles.css - would also be let through
tld.example.com/fake/path - would be redirected
Here is my current setup:
DocumentRoot /var/www
ServerName example.com
ServerAlias *.example.com
RewriteCond %{HTTP_HOST} ^tld.example.com [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !^/dir http://www.example.com [L,R=301]
Currently the above rule is redirecting all non /dir requests
[edited by: mercnboy3 at 4:44 pm (utc) on Mar. 23, 2009]
[edited by: jdMorgan at 5:16 pm (utc) on Mar. 23, 2009]
[edit reason] Please use example.com [/edit]
RewriteCond %{HTTP_HOST} ^tld\.example\.com [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !^/ http://www.example.com/ [R=301,L]
Jim
RewriteCond %{HTTP_HOST} ^tld\.example\.com [NC]
RewriteCond $1 !^css/
RewriteCond $1 !^dir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !^/(.*)$ http://www.example.com/ [R=301,L]
Jim
What specifically, in the URL, is it that allows you to tell a "fake/path" from a real path. Only by defining that in terms of URL and/or "file exists" can we then tell the server (in the mod_rewrite code) how to tell them apart.
Jim