how can i in the htaccess rewrite all using http:// or http:

Alles, was den Apache betrifft, kann hier besprochen werden.

how can i in the htaccess rewrite all using http:// or http:

Postby Begaunsberg » 09. December 2013 17:53

how can i in the htaccess rewrite all using http:// or http://www. to https? can anybody help me?

I have:

RewriteCond "%{SERVER_PORT}" "^80$"
RewriteRule "^(.*)$" "https://%{SERVER_NAME}/$1" [R=301,L]

...but a request via http://www. also needs to https://example.com/
Begaunsberg
 
Posts: 1
Joined: 09. December 2013 17:50
Operating System: windows7

Re: how can i in the htaccess rewrite all using http:// or h

Postby Nobbie » 10. December 2013 00:00

Begaunsberg wrote:...but a request via http://www. also needs to https://example.com/


Then you have to create a more sophisticated RewriteRule.

If you run your own server and have access to httpd.conf, it is by far easier not to use .htaccess and mod_rewrite, but simply do a redirect in the VirtualHost für www.example.com (with ServerAlias example.com):

Code: Select all
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
...
Redirect / https://example.com
...
</VirtualHost>
Nobbie
 
Posts: 13179
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 290 guests