网站子文件夹的Index.php
我的网站有一个网站子文件夹的Index.php,php,.htaccess,Php,.htaccess,我的网站有一个index.php文件。这一切都很好 我刚刚创建了一个新文件夹,我想在其中有一些不同的页面。此目录结构如下所示: root - index.php - .htaccess 我希望它看起来像: root - index.php - .htaccess - <folder> - <index.php for folder> - customer.php 谢谢我决定手动强制页面显示文件和目
index.php
文件。这一切都很好
我刚刚创建了一个新文件夹,我想在其中有一些不同的页面。此目录结构如下所示:
root
- index.php
- .htaccess
我希望它看起来像:
root
- index.php
- .htaccess
- <folder>
- <index.php for folder>
- customer.php
谢谢我决定手动强制页面显示文件和目录,这要感谢
#手动将/请求重新路由到folder.php
重写条件%{REQUEST_FILENAME}/$
重写规则^(.*)/$$1
每个文件夹都可以有一个index.php
文件。谢谢你的评论,但这并没有解决我问题的第二部分,你能回答吗?我想你正在寻找URL重写。为了使您不必针对每个文件夹(路径)添加index.php Hi@vishwakarma09,我添加了我的.htaccess
,我相信我正在部分尝试,谢谢。根文件夹中.htaccess的内容是什么?我相信这个htaccess-in-chid文件夹会将这个文件夹中所有不存在的文件路由到index.php
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^(.*) http://www.example.com/$1 [R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC]
RewriteEngine On
# Manually re-route <folder>/ requests to folder.php
RewriteCond %{REQUEST_FILENAME} <folder>/$
RewriteRule ^(.*)/$ $1