2014-09-10 151 views
0

網址我想這個網址重定向:刪除特殊字符?從的.htaccess

http://www.domena.pl/?tekst,123.html

這個

http://www.domena.pl/tekst,123.html

我只是想刪除?在第一個/後,所以我想重定向每個網址domena /?......到domena/......

我使用這個htaccess,它適用於domena/testtekst,123,但是我不知道我應該如何改變它以使用特殊字符?

RewriteCond %{HTTP_HOST} ^www.domena.pl$ 
RewriteCond %{REQUEST_URI} ^/test(.*)$ 
RewriteRule ^test(.*)$ http://www.domena.pl/$1 [L,R=301] 

這不起作用:

RewriteCond %{HTTP_HOST} ^www.domena.pl$ 
RewriteCond %{REQUEST_URI} ^/?(.*)$ 
RewriteRule ^?(.*)$ http://www.domena.pl/$1 [L,R=301] 

這並不工作過:

RewriteCond %{HTTP_HOST} ^www.domena.pl$ 
RewriteCond %{REQUEST_URI} ^/\?(.*)$ 
RewriteRule ^\?(.*)$ http://www.domena.pl/$1 [L,R=301] 

回答

0

您可以使用:

RewriteEngine On 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+\?([^\s&]+) [NC] 
RewriteRule^/%1? [R=302,L,NE]