0

Certain urls in my site gives 403 - access forbidden error. After doing several hours of research, i found that there is "." (dot) in my url causing the 403 error. I want to replace all dots to hyphen using .htaccess

for e.g. i want to change the following url from

http://www.example.com/real-listings/0Bedrooms/commercial-land/TN/For-Sale/SELLING-FIVE-ACRE-LAND./Property.html

TO

http://www.example.com/real-listings/0Bedrooms/commercial-land/TN/For-Sale/SELLING-FIVE-ACRE-LAND/Property.html

Please advise and your help appreciated.

regards,

4

1 に答える 1

0

ドキュメント ルートの htaccess ファイルにあるすべてのルールの前に、次のルールを追加します。

RewriteEngine On
RewriteRule ^(.*)\./([^/]+)(\.html?)$ /$1/$2$3 [L,R=301]

または、そのドットをハイフンに置き換えたい場合は、次のようにします。

RewriteEngine On
RewriteRule ^(.*)\./([^/]+)(\.html?)$ /$1-/$2$3 [L,R=301]
于 2012-10-12T16:58:39.520 に答える