好的,这里是这样的情况:我用我的codehostiter网站在bluehost是我没有root权限,我已经将该网站移动到rackspace。 我没有改变任何的PHP代码,但有一些意想不到的行为。
意外行为:
http://mysite.com/robots.txt旧的和新的解决scheme的机器人文件
http://mysite.com/robots.txt/旧的bluehost安装程序parsing为我的codeigniter 404错误页面。 rackspaceconfigurationparsing为: 未find请求的URL /robots.txt/在此服务器上找不到。
**这个实例让我相信我的mod重写可能会有问题,或者缺less这个问题。 第一个通过php正确地产生错误,而第二个senario让服务器处理这个错误。
这个问题的下一个例子更麻烦:' http : //mysite.com/search/term/9 x 1-1%2F2 white /'
新网站的结果: 错误的请求您的浏览器发送了一个此服务器无法理解的请求。
旧网站的结果是:正在加载的实际网页以及未编码的search字词。
我不得不假设,这与我到新服务器时,我从根级htaccess文件到httpd.conf文件和虚拟服务器默认和default-ssl的事实有关。 他们来了:
默认文件:
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName mysite.com DocumentRoot /var/www <Directory /> Options +FollowSymLinks AllowOverride None </Directory> <Directory /var/www> Options -Indexes +FollowSymLinks -MultiViews AllowOverride None Order allow,deny allow from all RewriteEngine On RewriteBase / # force no www. (also does the IP thing) RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} !^mysite\.com [NC] RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L] # index.php remove any index.php parts RewriteCond %{THE_REQUEST} /index\.(php|html) RewriteRule (.*)index\.(php|html)(.*)$ /$1$3 [r=301,L] RewriteCond $1 !^(index\.php|assets|robots\.txt|sitemap\.xml|favicon\.ico) RewriteRule ^(.*)$ /index.php/$1 [L] </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost>
Default-ssl文件基本上和上面的默认文件一样,只用来处理ssl端口
httpd.conf文件从html5锅炉板只是很多东西,我会发布它,如果需要的话
旧的htaccess文件
<IfModule mod_rewrite.c> # index.php remove any index.php parts RewriteCond %{THE_REQUEST} /index\.(php|html) RewriteRule (.*)index\.(php|html)(.*)$ /$1$3 [r=301,L] RewriteCond $1 !^(index\.php|assets|robots\.txt|sitemap\.xml|favicon\.ico) RewriteRule ^(.*)/$ /$1 [r=301,L] RewriteCond $1 !^(index\.php|assets|robots\.txt|sitemap\.xml|favicon\.ico) RewriteRule ^(.*)$ /index.php/$1 [L] </IfModule>
RewriteCond $ 1!^(index.php | assets | robots.txt | sitemap.xml | favicon.ico)
RewriteRule ^(。*)$ /index.php/$1 [L]
任何帮助将非常感谢!