2013-06-04 46 views
1

这是我目前的.htaccess删除文件夹:如何从URL使用Apache国防部重写

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?load=$1 [PT,L] 

这是网址:

http://domain.com/web-design/article/my-first-article 

我需要从去除 “文章” URL。

+2

重写规则不会不管这里既然你已经有了一个非常通用的规则。您的应用程序路由将。 – datasage

回答

0

将这个代码在你的.htaccess public_html下:

Options +FollowSymLinks -MultiViews
#Turn mod_rewrite on
RewriteEngine On RewriteBase /
RewriteRule ^((?!article/).*)$ article/$1 [NC,L]

然后你就可以访问你的网站,http://domain.com/web-design/my-first-article

+0

感谢您的快速回答,但我需要保持我的htaccess,只需添加规则来重写“文章/”。当我将你的代码合并到我的htaccess中时,我得到了500个内部服务器错误。 也许我真的需要更新我的应用程序路由器类? – Carlo