.htaccess - htaccess from www to non-www -


i'm having problem.

i have python(django) website, , want delete "www" url, have htaccess:

rewriteengine on rewritebase / rewritecond %{http_host} ^www.mydomain.com/$ [nc] rewriterule ^(/)?(.*) http://mydomain.com/$1 [r=301,l]  

it works, problem if enter url "www.domain.com/admin" or "www.domain.com/something" redirects "domain.com" instead of "domain.com/admin" or "domain.com/something".

do know wrong htaccess?

thanks lot time , help.

change ^(/)?(.*) ^/?(.*). you're capturing / , appending onto url, instead of part want append $1.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -