On 8/11/2020 3:00 AM, MEjaz wrote:
Hello,.
I have requirement to redirect the url. Whoever typed my site
http://newtraffic.cyberia.net.sa , it should redirect to
https://newtraffic.cyberia.net.sa
I am bit struggling to achieve this. please assit
Ejaz
As long as the request is staying on the same server, mod_rewrite is a
good use for this and I believe avoids another request as in a redirect.
The following 3 lines would go in your httpd.conf file.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}$1 [L,R=302]
https://httpd.apache.org/docs/current/mod/mod_rewrite.html
This assumes you want all http traffic handled via https and not just
the root of your site.
Change the 302 (temporary) to 301 (permanent) once you know things are
working as you like.
Jim