1
town
& country
の間にあるものを含むすべてのURLを、都市と国の間にダッシュを除く新しいURLにリダイレクトする改訂ルールが必要です。2つの単語の間の追加単語を含むすべてのURLをnon?にリダイレクトしますか?
例えば:
http://www.example.com/big-town-4-h-country-2j/
へ:
http://www.example.com/big-town-country-2j/
私はこのコードを試みたが、何も起こりません:
RewriteEngine on
RewriteRule (.*)town.+country(.*) $1town-country$2
を私の完全なhtaccessのコードは次のとおりです。
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
RewriteRule (.*)/$ /?l=$1
RewriteRule (.*)country-(.*)$ country.php?q=$1&l=$2&submit=1
</IfModule>
おかげで、それは – Smith
にこの問題についての任意のアイデアを働いた:http://stackoverflow.com/questions/38498774/return-404-error-for-all -extra-characters-after-second – Smith