Forum Moderators: phranque

Message Too Old, No Replies

Wildcard Redirect For Sub Directory

Wildcard Redirect For Sub Directory

         

goldleviathan

1:05 am on Jan 15, 2009 (gmt 0)

10+ Year Member



I would like to redirect individual pages from my old site (located in old sub directory on same domain) to one new main page (located in different sub directory on same domain).

For example:

[example...] needs to redirect to http://www.example.com/new/

What would be the easiest .htaccess script for this?

goldleviathan

1:10 am on Jan 15, 2009 (gmt 0)

10+ Year Member



I thought maybe I should clarify a bit more. I want all pages from old site that ended with .jsp to permanently redirect to the main index page of my new site. (no longer using jsp).

jdMorgan

1:40 am on Jan 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi goldleviathan. and welcome to WebmasterWorld!

Please review our Forum Charter [webmasterworld.com] for help getting the most from this forum.

Thanks,
Jim

goldleviathan

3:22 am on Jan 15, 2009 (gmt 0)

10+ Year Member



Ok, let me ask this a different way. I am currently using this rule:

Redirect 301 /html/oldsite1/ [domain.com...]
Redirect 301 /html/oldsite2/ [domain.com...]

RedirectMatch (.*)\.jsp$ [domain.com...]

How can I do this without the "index.php" showing up in the url?

(I want to redirect all jsp files to the new index.php without the index.php in the url)

goldleviathan

3:35 am on Jan 15, 2009 (gmt 0)

10+ Year Member



I just want it to forward all oldsite/*.jsp requests to the new site directory.

Caterham

10:34 am on Jan 15, 2009 (gmt 0)

10+ Year Member



(I want to redirect all jsp files to the new index.php without the index.php in the url)

Why don't you leave it out? Don't you have
"DirectoryIndex index.php" specified for /newsite/?

goldleviathan

3:36 pm on Jan 15, 2009 (gmt 0)

10+ Year Member



If I leave it out, it attempts to go to the same whatever.jsp file at the new site and I get a 404 error.

goldleviathan

3:47 pm on Jan 15, 2009 (gmt 0)

10+ Year Member



Ok, this seems to be working:

DirectoryIndex index.php
Redirect 301 /html/oldsite1/ [domain.com...]
Redirect 301 /html/oldsite2/ [domain.com...]
RedirectMatch (.*)\.jsp$ [domain.com...]