Allow url to avoid mod_rewrite rule in .htaccess

In addition to web access through my domain names, my ISP allows access to my site through the following format: user.hostname.com

where user

is my login name and hostname

is my ISP. I wrote rewrite rules to automatically reassign user.hostname.com

to www.mydomain.com

and it works well. It turns out, however, that in order to view statistics on my website, my ISP requires me to access user.hostname.com/stats/index.html

. With my rewrite rules, this changes to www.mydomain.com/stats/index.html

, and I cannot access the statistics page.

Is there a way that you can let it user.hostname.com/stats

go through unchanged while still rewriting all other queries user.hostname.com

?

Thank.

+2


source to share


1 answer


Try this if you are using Apache 2.2+:

RewriteRule ^/stats(|/.*)$ - [last]
# After that the other rewrites...

      



Prior to Apache 2.2, mod_rewrite does not seem to support '-' (dash) in the replacement pattern. In this case, use the following rule:

RewriteRule ^/stats(|/.*)$ /stats$1 [last]

      

+4


source







All Articles