Apache 试图用.htaccess重写并重定向双参数动态URL到静态URL,
我正在尝试重写和重定向博客的Apache 试图用.htaccess重写并重定向双参数动态URL到静态URL,,apache,.htaccess,mod-rewrite,url-rewriting,http-redirect,Apache,.htaccess,Mod Rewrite,Url Rewriting,Http Redirect,我正在尝试重写和重定向博客的 到,这样,如果在地址栏中输入上述任一URL,它将重定向到第二个URL RewriteEngine on #redirect from "/page.php?fid=123&name=title of the blog" to "/name/title-of-the-blog.jsp" RewriteCond %{THE_REQUEST} /page\.php\?fid=([^\s]+)&name=(-[^\s]+)$ [NC] RewriteRul
到
,这样,如果在地址栏中输入上述任一URL,它将重定向到第二个URL
RewriteEngine on
#redirect from "/page.php?fid=123&name=title of the blog" to "/name/title-of-the-blog.jsp"
RewriteCond %{THE_REQUEST} /page\.php\?fid=([^\s]+)&name=(-[^\s]+)$ [NC]
RewriteRule ^name/%2.jsp? [NC,L,R]
#Rewrite /name/title-of-the-blog.jsp to /page.php?fid=123&name=title of the blog
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^name/(-[^/]*)\.jsp$ /reply_forum.php?fid=$1&urdu=$2 [NC,L]
它不起作用,如果有人能检查上面的代码就好了。
谢谢。
重写规则^name/-1$.jsp?[NC,L,R]
无效(缺少模式)。但是重写规则^name/%2.jsp?[NC,L,R]
有效(注意^
和名称之间的空格)。不确定-1$
是什么,有。。。应该是%2
。名称是动态键吗?是,它是动态键,不是值。