[英]how to redirect rewrite rule link using .htaccess
我如何创建重写规则以使用.htaccess
获得漂亮的链接。 例如,我有一个这样的链接:
http://localhost/piratefiles/view.php?idp=2&cat=Animation&pst=In-this-Corner-of-the-World-(Kono-Sekai-no-Katasumi-ni)/
我想使我的网址像这样,我不需要链接中的(
或)
或:
等。
http://localhost/piratefiles/view/2/in-this-corner-of-the-world-kono-sekai-no-katsumi-ni
要不就
http://localhost/piratefiles/view/2/
我的密码
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} "^([^/]*?)(?:/|%20)+([^/]+?(?:/|%20)+.*)$"
RewriteRule ^ %{REQUEST_URI}?%1-%2 [N,NE]
RewriteCond %{QUERY_STRING} "^([^/]*?)(?:/|%20)+([^/]+?)/?$"
RewriteRule ^ %{REQUEST_URI}?%1-%2/ [L,R=302,NE]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/$ index.php [L]
#Your section
RewriteRule ^view/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ view.php?idp=$1&cat=$2&pst=$3 [NC,L]
ErrorDocument 404 http://www.akshadainfosystem.com/
RewriteRule ^([^\.]+)$ $1.php [NC,L]
将此代码放入您的.htaccess文件中,然后清除所有cookie
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.