New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize apache example.com => www.example.com #11
Comments
Thanks @a25ce1! Change made in fb1699d, but left |
Thank you. But my other suggest is change This is good for automatic adjust to all virtual name for local environment, not just only for |
@a25ce1: Sorry I've kinda missed that, mainly because the first time I've tested it didn't work on my machine (the reason was Thanks for bring it up again! From http://en.wikipedia.org/wiki/Localhost:
So, I think a better solution would be: <IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{SERVER_ADDR} !=127.0.0.1
RewriteCond %{SERVER_ADDR} !=::1
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule> |
That's right. I get new knowledge from you. You are very kind. Thanks! 😉 |
I know this is is old, but... who would want a non-www to www redirect when accessing via server IP? I know it's a corner case, but I think there's no harm in adding another condition like:
Correct me if I'm wrong please! |
@jaimergp I expect everyone to be redirected to the one, true, canonical version of the URL they accessed. You wouldn’t want the site at the server IP to be indexed separately by search engines, would you? |
use
replace
because:
xx.dev
instead oflocalhost
using hosts.anyone agree?
The text was updated successfully, but these errors were encountered: