Welcome to WebmasterWorld Guest from 3.81.29.226

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Redirect main domain some files to subdomain

exclude certain files redirection

     
10:53 am on Jan 6, 2004 (gmt 0)

New User

10+ Year Member

joined:Jan 6, 2004
posts:2
votes: 0


Hi All,

Belated new year wishes!

I have some files in my main domain the url like http://maindomain.com/products/product1/*.html and also *.pdf, Now i have subdomain url like http://subdomain.com/products/product1/*.html same files which is in main domain.

Here i want to redirect the main domain /product1/ to subdomain for *.html files only and not *.pdf.

Please help me on this using .htaccess file. This is very urgent.

[edited by: jdMorgan at 2:23 am (utc) on Jan. 8, 2004]
[edit reason] de-linked [/edit]

4:04 am on Jan 7, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


man_web,

Welcome to WebmasterWorld [webmasterworld.com]!

You can use Apache mod_rewrite, and add a RewriteCond to your RewriteRules, specifying that only .html files are to be redirected:


RewriteCond {REQUEST_URI} \.html$

- or alternately, specifying that .pdf files are *not* to be redirected:

RewriteCond {REQUEST_URI} !\.pdf$

Ref: Introduction to mod_rewrite [webmasterworld.com]

Jim

6:30 am on Jan 7, 2004 (gmt 0)

New User

10+ Year Member

joined:Jan 6, 2004
posts:2
votes: 0


Thanks for your quick response jim,

It is working fine. Now I want to redirect my files from maindomain.com/products/product1/ directory to subdomain.com/products/sample1/ directory.

Also the main domain /product1/ to subdomain for *.html files only and not *.pdf.

I am waiting for your reply.

:)Man

6:56 am on Jan 7, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Man,

We will be happy to help you debug your code if you wish to post it, but as our charter [webmasterworld.com] says, our purpose is to help you learn to write your own code, and not to write your code for you.

The reference I posted above, the Apache mod_rewrite documentation [httpd.apache.org], and the Apache URL Rewriting Guide [httpd.apache.org] are good places to learn how to do what you need to do.

Also, a WebmasterWorld site search [google.com] for related terms will turn up many threads on this subject.

Jim