2014-05-02 54 views
0

我想從我的網址使用的htaccess刪除查詢字符串,但我不能找到任何適當的解決辦法卸下網站URL查詢字符串

www.mysite.net/index.php?title=Category:Public_Companies &重定向=無& pagefrom = GET UP +

我想

www.mysite.net/Category:Public_Companies/GET+UP

我怎樣才能做到這一點。任何幫助將不勝感激。

回答

0

的快速簡便的方法 的.htaccess

RewriteEngine On 
RewriteRule ^(.*)/(.*) index.php?title=$1&pagefrom=$2&redirect=no [L] 

我爲你需要定義你會是什麼角色使用的所有字符創建。對於測試的.htaccess員工共贏網址

<?php print_r($_GET); ?> 
+0

我認爲,他希望它倒過來,從文件夾中的參數。 ('刪除查詢字符串') – meberhard

+0

我認爲他重複的問題 http://stackoverflow.com/questions/23404495/using-htaccess-url-redirection – set4812

+0

沒有什麼改變。 – user3526554

0

PHP文件把這個代碼在你DOCUMENT_ROOT/.htaccess文件:

RewriteEngine On 

RewriteCond %{THE_REQUEST} \s/+index\.php\?title=([^\s&]+)&redirect=no&pagefrom=([^\s&]+) [NC] 
RewriteRule^/%1/%2? [R=301,NE,L] 

RewriteRule ^([^/.]+)/([^/.]+)/?$ /index.php?title=$1&redirect=no&pagefrom=$2 [L,QSA] 
+0

它不適合我哥哥。 – user3526554

+0

你在瀏覽器中輸入了什麼網址,以及.htaccess文件的位置是什麼?還有更多規則嗎? – anubhava

+0

我的.htaccess放置在項目文件夾的根目錄下。和URL請看我的問題。在我的url中,最後一個參數的動態類似pagefrm或pageuntil。 – user3526554