I’ve read several url rewriting posts but nothing that helped me.
Basically on the website we have pages ending with “.html” (http://www.domain.com/page.html), and we also keep some other subdomains stuff (http://www.domain.com/subdomain.com)
So I’m trying to get this: http://www.domain.com/subdomain.com
to be redirect to: /www/subdomain.com/index.php
I tried this but there’s something wrong with it:
RewriteCond %{QUERY_STRING} !\.html$
RewriteCond %{QUERY_STRING} ^([^/.]+)\.([^/.]+)/?$
RewriteRule /www/%1.%2/index.php [L]
I think I’m misunderstanding the RewriteCond usage but I can’t find out how to do it properly.
What am I missing?
Thanks,
Rob
This should be close to:
Note that I’ve added the last part as a query argument for the
index.php.Oh by the way:
And if that’s not enough:
Two hints:
If you’re not in a hosted environment (= if it’s your own server and you can modify the virtual hosts, not only the
.htaccessfiles), try to use theRewriteLogdirective: it helps you to track down such problems:My favorite tool to check for regexp:
http://www.quanetic.com/Regex (don’t forget to choose ereg(POSIX) instead of preg(PCRE)!)