我希望将所有http://localhost/webportal/organizations/32请求重定向到http://localhost/webportal/organizations/32?qt-organization_tabs=tab1#qt-organization_tabs (其中32是一个变量)。
我如何使用mod_rewite来完成这个任务呢?
更新:
我已经更新了上面的URL,最初发布的URL是不正确的,无论如何,我尝试了以下规则,但它不起作用:
RewriteRule ^/organizations/(.+)$ ^/organizations/$1?qt-organization_tabs=tab1#qt-organization_tabs [L,R]所有其他规则都正常工作,以下是我的htaccess文件(Drupal )的相关部分:
RewriteEngine on
RewriteRule "(^|/)\." - [F]
RewriteBase /webportal
RewriteRule ^/organizations/(.+)$ ^/organizations/$1?qt-organization_tabs=tab1#qt-organization_tabs [L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]谢谢
发布于 2012-10-25 06:40:30
将其添加到文档根目录中的htaccess文件中:
RewriteEngine On
RewriteRule ^/?webportal/organizations/(.+)$ /pepris/webportal/$1?qt-organization_tabs=tab1#qt-organization_tabs [L,R]您还可以使用mod_alias:
RedirectMatch ^/?webportal/organizations/(.+)$ /pepris/webportal/$1?qt-organization_tabs=tab1#qt-organization_tabshttps://stackoverflow.com/questions/13062928
复制相似问题