Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess htacces重写url-将文件夹重定向到php文件_.htaccess - Fatal编程技术网

.htaccess htacces重写url-将文件夹重定向到php文件

.htaccess htacces重写url-将文件夹重定向到php文件,.htaccess,.htaccess,我想重定向或重写子目录到PHP文件 例如: http://www.domain.org/contact 为此: http://www.domain.org/index.php?sub=contact 我真的希望它是PHP可以读domain.org/contact作为domain.org/index.PHP?sub=contact,但如果它只是重定向,我会很高兴!我使用.htaccess搜索了许多解决方案,但它们不清楚,或者我无法让它们专门用于我正在尝试的工作 谢谢你试试这个 RewriteE

我想重定向或重写子目录到PHP文件

例如:

http://www.domain.org/contact
为此:

http://www.domain.org/index.php?sub=contact
我真的希望它是PHP可以读domain.org/contact作为domain.org/index.PHP?sub=contact,但如果它只是重定向,我会很高兴!我使用.htaccess搜索了许多解决方案,但它们不清楚,或者我无法让它们专门用于我正在尝试的工作

谢谢你试试这个

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?sub=$1