2012-08-11 67 views
-1

我想我的網址,從改變URL設置了一個param:使用htaccess的如何更改使用的htaccess

http://my-domain.com/article/thinking-something-in-hataccess 

http://my-domain.com/blog/thinking-something-in-hataccess 

什麼?

+0

你有什麼試過?什麼地方出了錯?另外,請查看[手冊](http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule),還有很多相當不錯的[教程](https:// www .google.com /查詢q = mod_rewrite的+教程)。 – 2012-08-11 11:17:41

回答

1

確保所有鏈接已指向http://my-domain.com/article/thinking-something-in-hataccess,那麼你可以這樣你的文檔根添加到您的htaccess文件:

RewriteEngine On 
RewriteRule ^/?blog/(.*)$ /article/$1 [L] 

你可能需要在這裏調整正則表達式更具體地匹配什麼你需要。例如,用([^/]*)代替(.*)將匹配something-something,但不是something/something