2017-01-18 88 views
1

我在URL末尾有一個跟蹤斜槓問題。我查詢的網址重定向網上,結果表明我,我有我的網頁上過多的重定向,所以我需要減少我有我的鏈接我如何從URL中刪除尾部斜槓

https://example.com/xyz/pqr 
302 Found 
https://example.com/xyz/pqr/ 
302 Found 
https://example.com/xyz/pqr// 
302 Found 
https://example.com/xyz/pqr/// 
302 Found 
https://example.com/xyz/pqr//// 
302 Found 
https://example.com/xyz/pqr///// 
302 Found 
https://example.com/xyz/pqr////// 
302 Found 
https://example.com/xyz/pqr/////// 
302 Found 
https://example.com/xyz/pqr//////// 
302 Found 
https://example.com/xyz/pqr///////// 
302 Found 
https://example.com/xyz/pqr////////// 
302 Found 
https://example.com/xyz/pqr/////////// 
302 Found 
https://example.com/xyz/pqr//////////// 
302 Found 
https://example.com/xyz/pqr///////////// 
302 Found 
https://example.com/xyz/pqr////////////// 
302 Found 
https://example.com/xyz/pqr/////////////// 
302 Found 
https://example.com/xyz/pqr//////////////// 
302 Found 
https://example.com/xyz/pqr///////////////// 
302 Found 
https://example.com/xyz/pqr////////////////// 
302 Found 
https://example.com/xyz/pqr/////////////////// 
302 Found 

以下結果,我怎麼能解決這個問題的重定向??我不知道我要去哪裏錯了。任何幫助將被預先設定。提前致謝。

這裏是我的htaccess代碼:

RewriteEngine on 
RewriteCond %{QUERY_STRING} p=3842 
RewriteRule^/? [R=301,L] 

這就是我在我的htaccess的代碼,其餘的只是一個301個重定向,僅此而已.. !!

+0

後從.htaccess文件與重定向打交道的代碼。 – besciualex

+0

嗯,我編輯了我的問題,並在那裏添加了htaccess代碼。請檢查一下。 –

回答

0

要刪除使用.htaccess你可以使用斜線:

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} (.+)/$ 
RewriteRule^%1 [R=301,L] 
+0

如果我只是想檢查它是否正確重定向或不我需要在上面的代碼進行任何更改? 301意味着一個permanant重定向之前這樣做,我需要檢查第一個天氣它是否工作。 –