【发布时间】:2016-06-23 16:48:49
【问题描述】:
如何转换 .htaccess 中的一些重写规则? 我的旧网站有以下内容:
RewriteRule ^([^/]*)\.html$ index.php?name=$1 [L]
这会将 url 重写为:domain.com/some-page.html
现在我正在对虚拟目录使用不同的重写,例如:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
这翻译成 domain.com/page/somepage/
我尝试过使用
Redirect 301 some-page.html page/somepage/
但不断收到 404 错误
【问题讨论】:
标签: .htaccess mod-rewrite url-rewriting