2015-04-28 26 views
1

我試圖重定向url格式錯誤的查詢字符串由joomla生成。htaccess格式錯誤的查詢字符串重定向

的URL /index.php?/Some-String/(注意沒有一個正規的參數?x=),以執行下列操作之一:

/some-string 

/index.php?q=/Some-String/ 

我試圖Redirect 301 /index.php?/Some-String/ /some-string 但我得到一個重定向/?%2FSome-String%2F=

I也嘗試用?q=/取代?/而沒有成功。

回答

0

也許這樣?

RewriteEngine On 

RewriteCond {THE_REQUEST} \ /+index\.php\?(?:q=|)([^&\ ]+) 
RewriteRule^/%1? [L,R] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.+)$ /index.php?q=$1 [L,QSA] 
+0

它不工作。它仍然重定向到'/?%2FSome-String%2F =' – Cezar

+0

其他的東西正在重定向,那麼可能是在PHP腳本中的東西? –

+0

有可能你對'/?%2FSome-String%2F ='是正確的應用程序重定向的結果。然而,我測試了一個空文件夾,只有.htaccess和一個空的index.php,現在它根本沒有重定向。即使將目標從index.php更改爲test.php,也沒有任何反應。 – Cezar

相關問題