![](/img/trans.png)
[英]How to remove multiple file extensions with Htaccess and redirect file extension URLs
[英]How to redirect multiple similar URLs with one query?
我目前有很多看起來像這樣的URL:
http://www.domain.com/classes-dallas-tx.html
我需要將所有URL更改為以下內容:
http://www.domain.com/classes-in-dallas-tx.html
我只需要將“輸入”添加到當前沒有它的每個URL中。
我可以對.htaccess文件使用一個查詢,該查詢可以為我處理所有URL嗎? 我打算使用301重定向。
謝謝!
嘗試:
RedirectMatch 301 ^/([^-]+)-([^-]+)-([^-]{2})\.html$ /$1-in-$2-$3.html
要么
RewriteEngine On
RewriteRule ^/?([^-]+)-([^-]+)-([^-]{2})\.html$ /$1-in-$2-$3.html [L,R=301]
在文檔根目錄的htaccess文件中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.