English 中文(简体)
.htaccess重定向[强制www,但index.php除外]
原标题:.htaccess Redirection [force www except index.php]

我正在尝试基于以下条件进行htaccess重定向:

Redirect all pages without "www" http://siteweb.com to http://www.siteweb.com/index.html Except http://siteweb.com/index.php

http://siteweb.com/index.php必须将重定向到http://www.siteweb.com/index.php

实际上,我使用了这段代码[但上面有点错误:s]

RewriteCond %{HTTP_HOST} !^www.
RewriteRule !^/index.php$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/index.php$ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

提前感谢。

问题回答

..

RewriteCond %{HTTP_HOST} !^www.. [NC]
RewriteRule (?!^index..php$)^(..*)$ http://www..%{HTTP_HOST}/$1 [R=301,L,NC]

*索引。。php{URI}索引。。php{URI}<<1code>>*

<代码>http://siteweb..com/index..php_http://www..siteweb..com/index..php

索引。。php<<代码><代码><代码><代码><1www*





相关问题
Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

Multiple Sites with common files

I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, I currently duplicate the files each time I create a new site and upload different css and images. What ...

http server validation

I finish a litle http server, writing from scratch. I would like to be sure that my imlementation is conforme to the HTTP specifications. W3C give us tools for HTML/XML conformance, but i see nothing ...