How to add .php extension using .htaccess url rewr

2019-02-20 17:33发布

I have set up .htaccess file on my website which display SLUG text as page name in URL but without extension. e.g. Real url is

www.mywebsite.com/page.php?page=about-us

Then it loads on below url through url rewriting

www.mywebsite.com/about-us

Below is my .htaccess file code

Options +FollowSymlinks
RewriteEngine On

RewriteCond %{REQUEST_URI} !^.*(images/|\.js|\.css).*$ [NC]
RewriteRule ^([a-zA-Z0-9_-]+)$ /page.php?page=$1

Now I want to show the .php extension on all pages, so that the urls should be like below

www.mywebsite.com/about-us.php

How can I do this ?

1条回答
Explosion°爆炸
2楼-- · 2019-02-20 17:51
Options +FollowSymlinks
RewriteEngine On

RewriteCond %{REQUEST_URI} !^.*(images/|\.js|\.css).*$ [NC]
RewriteRule ^([a-zA-Z0-9_-]+)\.php$ /page.php?page=$1
查看更多
登录 后发表回答