http://mysite/contactform/contact.html?queryvars
/contactform目录中的任何内容,包括子目录(只是一些css、js、images等),都不应该通过CodeIgniter管道。最好的办法是什么?(我通常是Windows开发人员,所以说慢一点)
我想必须在重写配置中完成?
$route['default_controller'] = "home";
# you probably want www.example.com to forward to example.com -- shorter URLs are sexier. # no-www.org/faq.php?q=class_b RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteEngine on RewriteCond $1 !^(index\.php|contact\.php|images|css|js|video|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L]
修改您的.htaccess,如下所示:
RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d 告诉它忽略它,如果它是一个目录。
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d