站点结构
/articles/Employment/Companies.php
/articles/Employment/Companies/.htaccess
/articles/Employment/Companies/index.php.htaccess文件读取
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ index.php [L]所以当你去
/文章/就业/公司/公司类型
它正在显示index.php页面。
问题
我正试着连接到
/条文/就业/Companies.php
但是,如果我链接到
/文章/就业/公司
它会
/文章/就业/公司/
我理想中要找的是
folder/hello
/,所以如果您进入/hello,它将在特定目录中显示/hello.php,比如我当前的.htaccess文件位于/this或/that将显示.php的位置发布于 2020-10-07 03:10:38
请尝试使用下面的方法,使用rewritecond和您现有的规则,如果请求实际上是针对非index.php的php文件,那么就提供更少的扩展代码。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule !index.php$ $1.php [L]https://stackoverflow.com/questions/64232113
复制相似问题