redirect https non-www Apache
Hi all,
I need to redirect any request to my server as the following from https://myserver.com to https://www.myserver.com I tried the following code but it only worked for http not https Quote:
|
Hi,
You can use: Code:
Options +FollowSymlinks Regards |
Hi Bathory,
I put your code inside httpd.conf but https://myserver.com didnt go to https://www.myserver.com. however it worked for http://myserver.conf. Please note I have defined the default server name to: www.myserver.com:443 |
[untested]
Not sure if it will work, but you could give this a try -
Code:
RewriteCond %{HTTPS} ^on$ |
You can put the rewrite stuff inside the <Directory ..></Directory> part of the document root. If your DocumentRoot is /var/www/html, you can use:
Code:
<Directory "/var/www/html"> Cheers |
Also did not work. in both cases I notice some url manipulation but it gets stuck on https://myserver.com
|
Try the following that checks for both SSL and FQDN:
Code:
RewriteEngine on |
This did not work bathory :S
I solved it on my testing environment using 2 name-based ssl vh and i put the following inside myserver.com:443 Quote:
any ideas?? |
Quote:
|
my live environment does not support name based ssl vh....I have old version of openssl installed.
|
Hi,
Even if it's a production server, you should consider upgrading apache/openssl due to security bugs in older versions. Regarding the rewrite rules, I guess that both the ssl vhosts (myserver.com and www.myserver.com) use the same docroot. If that's the case, you can put the rewrite stuff from my previous post in a .htaccess in the docroot Regards |
it is working after putting the code inside .htaccess :).
but why it should be inside .htaccess if the 2 vhs in the same docroot?! another question. is there will be a side effect problems after using this rules. for example if the link contains special characters like "?" etc... I am newbie to rewrite..the following is the modified version to only redirect https://myserver.com to https://www.myserver.com and keep http links intact Code:
RewriteCond %{HTTPS} on |
Quote:
Quote:
Regards |
I confirm it is working if I put the code inside httpd.conf under Directory directive.
|
I have added SSL to my website https://www.pnrstatusbuzz.in/ and redirect http non-www to https www with htaccess but sometime https shows in my domain name and sometimes not on browsers. I just want to know whether it's htaccess redirection code issue or SSL installation issue or anything else. If you ask i can show you my htaccess codes. I have tried all the possible way but none worked. Please guide me what to do and how to solve this issue.
|
All times are GMT -5. The time now is 02:55 PM. |