简体   繁体   中英

How do I add code to remove the .php from the .htaccess file when I already have a redirect?

I already have code to add the https ... so how do I remove the .php from the end of the url as well? This is what my code looks like so far.

RewriteEngine On

RewriteCond %{HTTPS} off 

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

I also want to add the www to the front of the url ... eg https://www.google.com

You can remove .php like this:

RewriteRule ^index    index.php

Then you need to call www.example.com/index instead of www.example.com/index.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM