Forum Moderators: phranque

Message Too Old, No Replies

Changing file names and directory names

permanent redirect half working

         

gingerbreadman

8:10 am on May 21, 2003 (gmt 0)

10+ Year Member



Running apache.

I have recently renamed a lot of directories directories on my site.e.g.

[domain.com...]
to
[domain.com...]

I have also renamed a lot of pages inside the directories e.g.

[domain.com...]
has now become
[domain.com...]

I have set up permanent 301 redirects for all of the individual pages so that spiders now that the content has been permantenly moved.

How do I cater for pages that have been indexed as
[domain.com...]

Doing it this way...

Redirect permanent /bwdgt/ [domain.com...]

...has caused problems for the individual pages that I have redirected.

Any help would be appreciated. cheers

jdMorgan

5:01 pm on May 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



gbm,

If you mean you are having problems with query-string based resources, then Redirect directives won't work; AFAIK, they don't pass-on the query string.

If you have access to mod_rewrite, you can use rules such as


RewriteRule ^bwdgt/ http://www.domain.com/blue-widget/?%{QUERY_STRING} [R=301,L]

to pass the query string to the new URL.

HTH,
Jim

dabrisz

8:11 pm on May 21, 2003 (gmt 0)

10+ Year Member



How do you do the same with IIS 5.0? Do you have to use server side scripting on the 404 page?

gingerbreadman

9:27 am on May 22, 2003 (gmt 0)

10+ Year Member



Sorry the question mark was used at the end of the question and was not supposed to indicate the start of a querystring.

How do I cater for pages that have been indexed as
[domain.com...]

jdMorgan

2:01 pm on May 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



gbm,

You got me good on that one! :)

You can still use mod_rewrite, but if you're more comfortable with Redirect-type directives, try using RedirectMatch instead. Redirect uses prefix-matching, which I believe is the cause of your problem with directory-index pages, while RedirectMatch allows you to match exact patterns.

Jim

daisho

3:35 pm on May 22, 2003 (gmt 0)

10+ Year Member



Rather then getting to complicated why not just put a new default.php page in the directory saying:

Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: [domain.com...] );

daisho.