开发者

.htaccess script

I want any requests with any extra "words"[paths] (e.g., www.mysite.com/words/index.html, etc.)just to be directed to my "index" page. If the word index is in the url, I want the page to be direct to the /.

Presently I have:

RewriteCond %{THE_REQUEST} ^.*/index\.html

RewriteRule ^(.*)index.html$ http://www.mysite.com/$1 [R=301,L] 

It directs pages that have index.html in the url, but not pages that may have variants [additional paths]like: www.mysite.com/words/index.html. In other words, somebody that may be looking for an index on the page "words" types this in their browser to look for the "index" of the "words" page. They should go to www.mysite.com/. Instead, it directs to the real page if it exists, but just shows text--not pics and other items on the page. Again, I don't want a partial page display, just redirected to the index page, wh开发者_如何学Pythonich is /.


If I understand your question correctly, you want

http://www.mysite.com/index.html

to redirect to

http://www.mysite.com/

and

http://www.mysite.com/words/index.html

also to redirect to

http://www.mysite.com/

It seems to me a simple way to do that would be

RewriteRule index\.html$ http://www.mysite.com/ [R,L,NC]

Have I missed something?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜