BR
asked on
.htaccess file settings
Dear Experts,
my htacces file is like below:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
I redirect all http pages to https pages, it works perfectly fine.
in addition to this, I want to redirect all page request like
http://google.com to https://www.google.com ( I want to convert http to https and I want to use also www if my user do not type it )
otherwise google analytics calculate the pages like they are separate pages
could you please help me?
I use php and mysql
my htacces file is like below:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
I redirect all http pages to https pages, it works perfectly fine.
in addition to this, I want to redirect all page request like
http://google.com to https://www.google.com ( I want to convert http to https and I want to use also www if my user do not type it )
otherwise google analytics calculate the pages like they are separate pages
could you please help me?
I use php and mysql
ASKER
Dear Ray, thank you very much.
You are right. In the future, I would need subdomains.
Canonical representation is better for my web site.
Sould I do it like this?
if my user request my web site example.com, I should redirect to https://example.com
if my user writes www.example.com, I should use Canonical representation https://example.com
right?
You are right. In the future, I would need subdomains.
Canonical representation is better for my web site.
Sould I do it like this?
if my user request my web site example.com, I should redirect to https://example.com
if my user writes www.example.com, I should use Canonical representation https://example.com
right?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you Ray,
you are great.
you are great.
example.com -- no subdomain, the canonical representation of your web site
www.example.com- - rewrite to remove www and redirect to example.com
test.example.com -- the test version of your site; do not rewrite
docs.example.com -- the documentation for your site; do not rewrite
api.domain.com -- the RESTful API to your site; do not rewrite
This design will preserve good information for Google Analytics and will allow you to use relative links in your markup. It's good enough for Twitter ;-)