我有点难倒在这里。我一定是100多篇文章和帖子寻找一个解决方案。
我试图把这样的:
sub.domain.org/folder/index.php?p=home
进入:
sub.domain.org/folder/home/
下面
我的规则已经发展很多次,但几乎都不能正常工作。我不知道还有什么尝试。真的AP preciate一些帮助在这里。mod-rewrite启用,而且我托管自己的服务器。
选项+了FollowSymLinks
RewriteEngine叙述上
重写规则^ /?文件夹/(.*)/$ /folder/index.php?p=$1 [L]
解决方案
试试这个code。在 /folder/.htaccess
:
选项+了FollowSymLinks -MultiViews
RewriteEngine叙述上
的RewriteBase /文件夹/
的RewriteCond%{} THE_REQUEST /index.php?p=([^s&]+)[NC]
重写规则^%1 /? [R = 301,L]
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{} REQUEST_FILENAME!-f
重写规则^(。+?)/?$的index.php?P = $ 1 [L,QSA]
I'm a bit stumped here. I must have been over 100 articles and posts searching for a solution for this.
I'm trying to turn this:
sub.domain.org/folder/index.php?p=home
Into:
sub.domain.org/folder/home/
My Rule below have evolved many times but almost everything does not work. I don't know what else to try. Would really appreciate some help here. Mod Rewrite is enabled, and I'm hosting my own server.
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^/?folder/(.*)/$ /folder/index.php?p=$1 [L]
解决方案
Try this code in /folder/.htaccess
:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /folder/
RewriteCond %{THE_REQUEST} /index.php?p=([^s&]+) [NC]
RewriteRule ^ %1/? [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+?)/?$ index.php?p=$1 [L,QSA]