joe
joe

Reputation: 1135

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

Upvotes: 1

Views: 347

Answers (2)

SnapShot
SnapShot

Reputation: 5544

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/

Upvotes: 3

Rez
Rez

Reputation: 36

Your .htaccess file should look like this:

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

Upvotes: 2

Related Questions