在索引页面之后路由所有页面

时间:2022-11-02 20:08:11

I Use simple configuration in .htaccess file

我在.htaccess文件中使用简单配置

RewriteEngine on   
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

It help me to remove .php from pages now i want to get all pages after index like this is my index page https://www.example.com/index if i point to about page it should move after index like this https://www.example.com/index/about also my about page is in same directory kindly Help !

它帮助我从页面中删除.php现在我希望获得索引之后的所有页面,就像这是我的索引页面https://www.example.com/index如果我指向它应该在索引之后移动的页面如此https: //www.example.com/index/about我的页面也在同一个目录中,请帮忙!

Thanks

1 个解决方案

#1


0  

Try this rule:

试试这条规则:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^([^/]+)(/.*)?/?$ /$1.php$2 [L]

#1


0  

Try this rule:

试试这条规则:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^([^/]+)(/.*)?/?$ /$1.php$2 [L]