Forum Moderators: phranque

Message Too Old, No Replies

Redirect multiple files in htaccess

301 redirect using wildcards

         

cybertime

11:42 am on Apr 12, 2004 (gmt 0)

10+ Year Member



How to redirect using wildcards?

I have changed the names of 10 files and the extensions - html to htm - and wanted to use wildcards in htaccess... Is there a method of 301 redirect wherein a single line using wildcards can be written which while redirecting to the new files, i.e cafe.html to cafe.htm.

Is this the right way?

Redirect 301 /.*.html /.*.htm

Thanks.

jdMorgan

10:37 pm on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



cybertime,

Sure -- See RedirectMatch [httpd.apache.org] in Apache mod_alias.

Jim

cybertime

2:37 pm on Apr 13, 2004 (gmt 0)

10+ Year Member



Thank you jdMorgan.

One more question, if I may,

Is there a way to exclude a file i.e the index file was index.html now index.htm?

My web address now shows as www.domain.com/index.htm instead of www.domain.com.

Does it matter to search engines/robots if the address defaults to www.domain.com/index.htm instead of www.domain.com?

Thank you.

cybertime

6:17 pm on Apr 20, 2004 (gmt 0)

10+ Year Member



I contacted my host and was advise to add the following line to the .htaccess file.

DirectoryIndex index.htm