首页 > 解决方案 > .htaccess code for multiple page of same directory

问题描述

I have near about 50 PHP page which is shown in address bar like - http://www.example.com/STOP_WATCH/index.php or http://www.example.com/STOP_WATCH/second.php for friendly url I was create a htaccess file with the following code- RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php? RewriteRule ^(.*)$ second.php? -I have to know the rule for show the page like - http://www.example.com/STOP_WATCH/second.

标签: .htaccess

解决方案


以下代码适用于我:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

你可以看看这里


推荐阅读