Forum Moderators: phranque
Here's what I have
ex. - [subdomain.example.com...] gets rewritten to
[example.com...]
Perfect working like a charm...now for the problem
I need to also rewrite
to
[example.com...]
Nope...not happening.
I've tried a number of different things in htaccess but none of them are working properly.
When I try
RewriteCond %{HTTP_HOST}!^www\.example.net [NC]
RewriteCond %{HTTP_HOST}!^example\.net [NC]
RewriteRule ^(.+) %{HTTP_HOST}/$1 [C]
RewriteRule ^(.+)\.example\.net/(.*) index.php?c=$1&s=$2 [L]
For some reason variable $2 gets set with "index.php" instead of the subdirectory even though the URL is in the form of [subdomain.example.com...]
Any help would be greatly appreciated.
As for the .com/.net thing, it is a .net site. The example.com was just a generalized example url so no that's not it.
Anyone else have any ideas? I've spent pretty much the last 24 hours stuck on this one thing and it's starting to p*ss me off. ;)
subdomain.example.com, and REQUEST_URI is not the directory index of the subdomain, rewrite the address to http://www.example.com/index.php?c=subdomain. I'd probably use a regex like this to check if REQUEST_URI is a directory index (assuming index.html is the filename): (¦/¦/index\.html)
Pseudo-code for your second case:
If HTTP_HOST is
subdomain.example.com, and REQUEST_URI is a subdirectory, rewrite the address to http://www.example.com/index.php?c=subdomain&s=subdirectory. When you check for existence of the subdirectory, obviously you wouldn't use -d in your RewriteCond; you'd just need to check that it's not a directory index.