regex - Redirect to https but without .php -
now have https. need redirection in .htaccess. find this:
rewritecond %{https} off rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301]
but find if user writes:
http://mydomain/somefile
it redirects to:
https://mydomain/somefile.php
i suppose correct should without .php how that?
those rules:
rewritecond %{https} off rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301] rewritecond %{http_host} !^www\. rewriterule ^(.*)$ https://www.%{http_host}/$1 [r=301,l] rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^(.*)$ $1.php
here working code problem. have checked on server, , working fine
rewriteengine on rewritebase / #for https rewritecond %{https} off rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301] rewritecond %{the_request} ^[a-z]{3,9}\ /([^\ ]+)\.php rewriterule ^/?(.*)\.php$ /$1 [l,r=301] rewritecond %{request_filename}\.php -f rewriterule ^/?(.*)$ /$1.php [l]
here link explanation of above code - explain htaccess rules?
Comments
Post a Comment