开发者

HTACCESS - REDIRECT

I have a few old files: homepage.html and home.html which I am sure that people bookmarked them. so I want to redirect them to the parent url. I have looked through google but they seem not to meet what i expect.

for example www.开发者_开发问答nicetomeetyou.com/home.html and www.nicetomeetyou.com/homepage.html => these files don't exist.

I want them to be redirected to http://www.nicetomeetyou

How do I go about it? Thanks


Another possibility is to use RedirectPermanent in your .htaccess file which will let you target only specific files and let the client know that the redirect is permanent. If you have a number of files you can use a regular expression to redirect all of them in one line.

See here for details or the official documentation.

Here is an example:

RedirectPermanent /home.html http://example.com/


Your .htaccess file should look like this:

RewriteEngine ON
RewriteRule ^homepage.html$ index.html
RewriteRule ^home.html$ index.html
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜