【发布时间】:2009-12-30 12:30:30
【问题描述】:
好的,所以我不知道这是服务器问题还是什么。我有一个像这样的 htaccess 文件:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/main/index/$1 [L]
RewriteRule ^ajax/(.*)$ /index.php?/main/ajax/$1 [L]
RewriteRule ^backend.php/(.*)$ /backend.php?/$1 [L]
# 301 redirects
Redirect 301 /backup.php http://www.example.com/backup/
Redirect 301 /document.php http://www.example.com/document/
Redirect 301 /contact.php http://www.example.com/contact/
Redirect 301 /links.php http://www.example.com/links/
Redirect 301 /jobs.php http://www.example.com/jobs/
我唯一的问题是我的 301 重定向。而不是
example.com/backup.php 转到 example.com/backup/ 而是将其发送到 example.com/backup/?/main/index/backup.php。
这确实可以正确路由页面。这意味着我得到了正确的 html 返回,但 url 很丑。我应该说这是在代码点火器中完成的,并且我将一切都路由到 main 控制器的方法 index 这使得备份、文档、联系人等成为 index 方法的第一个参数。这可能看起来很奇怪 - 也可能没有相关性 - 但我需要它是这样的。有人对如何清理重定向的 url 有任何建议吗?
【问题讨论】:
标签: php .htaccess codeigniter redirect