我正在做一个应用程序,您可以在文件夹中存储文件等。.htaccess双重写规则到同一个文件
我在我的.htaccess文件中有一个小问题,因为我希望能够将两个规则重定向到同一个页面,其中一个没有属性。
我想example.com/drive
本身reqrite到example.com/drive.php
和它这样做这部分工作,但我也想example.com/drive/path/to/a/dir/here/
本身重写example.com/drive?dir=drive/path/to/a/dir/here/
。
这可能与.htaccess文件?如果是,如何?
这是我到目前为止的代码:
DirectoryIndex home.php
DirectoryIndex index.php
ErrorDocument 404 /err/404.php
ErrorDocument 500 /err/500.php
Options +FollowSymlinks
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ /$1.php [L,QSA]
RewriteRule ^u/(.+)$ /profile.php?u=$1 [L,QSA]
RewriteRule ^f/(.+)$ /file.php?f=$1 [L,QSA]
RewriteRule ^s/(.+)/(.+)$ /page.php?p=$1&f=$2 [L,QSA]
RewriteRule ^s/(.+)$ /page.php?p=$1 [L,QSA]
RewriteRule ^dir/(.+)$ /drive.php?dir=$1 [L,QSA]
此代码使用目录中的URL不会开车,但是这不是我想要的。
在此先感谢
你觉得为什么它的作品使用* dir *而不是* drive *?是* example.com/drive/path/to/a/dir/here/*中的所有文件夹,变量?意思是,它们是动态变化的? – 5ervant 2013-04-08 15:33:20