开发者

There has to be a way to redirect everything to one page, right? [duplicate]

This question already has answers here: htaccess redirect all pages to single page (6 answers) Closed 9 years ago.

I have a site and I want to redirect everything to /index.html.

I'm replacing an old site so some visitors may try to access dead urls. How can I do this through .htaccess?

Also, is there a way to rewrite the url in the process so they just see http://www.e开发者_JAVA百科xample.com and not whatever they originally tried to access?

Thanks, Howie


This should do the job:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.html

the index.html shall stay in the same directory of the htacess


  1. Open IIS.
  2. Select your website in left pane.
  3. In IIS 7 choose option Default documents in middle box and add your required index page. In IIS 3 right click on website in left pane and choose properties>home directory> then add your index page name and bring it to top (Top for priority).
  4. In the same page you have option to redirect your URL to another URL
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜