example.com/test/?var=somevalue或example.com/test/page1.html?var重寫URL = someValue中
到
example.com/test/som安勤/
下面是代碼
RewriteCond %{REQUEST_URI} test/$
RewriteCond %{QUERY_STRING} var=([a-z]*|[a-z]*\-[a-z]*)$
RewriteRule ^test/(.*)$ /test/%1/page1.html? [R=301,L]
這對於目前僅適用於網址example.com/test/?var=somevalue什麼,我不能去工作的網址與網頁[1-9] [0-9] * \。HTML QUERY_STRING
如此做路徑'/測試/ somevalue'實際存在的,或者是你想迫使查詢字符串形式的入站的網址被重定向到搜索引擎優化的形式,則仍然在內部改寫呢?請重新說明:1)您的最終用戶看到的URL 2)是否允許使用_only_最終用戶的URL 3)您的服務器最終接收和處理的URL是什麼 –
最終用戶可以看到'/ test /','/ test /如果query_string包含var,那麼它將被重定向到'/ test /(var value)/ page1。 .html' – user1527484