且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

阿帕奇的.htaccess URL重写

更新时间:2023-09-18 23:36:40

您必须首先获取查询字符串部分用的 的RewriteCond 和的客户端重定向到新的URL

You must first capture the query string part with a RewriteCond and redirect the client to the new URL

RewriteEngine on
RewriteCond %{ENV:REDIRECT_SEO} !1
RewriteCond %{QUERY_STRING} organization=(.+)
RewriteRule ^/?industry/industry_locator_proc.asp /industry/%1? [R,L]

现在的客户端请求新的URL和您服务从现有的ASP请求

Now the client requests the new URL and you serve the request from the existing ASP

RewriteCond %{REQUEST_URI} !industry_locator_proc.asp
RewriteRule ^/?industry/(.*) /industry/industry_locator_proc.asp?organization=$1 [E=SEO:1,L]

环境设置 E = SEO:1 prevents无限循环

The environment setting E=SEO:1 prevents an endless loop.

当一切工作,因为它应该,你可以替换研究 R = 301

When everything works as it should, you can replace R with R=301.