Forum Moderators: phranque

Message Too Old, No Replies

.htaccess question

I know this has been asked a million times...

         

Donboy

4:55 pm on Jun 18, 2003 (gmt 0)

10+ Year Member



I know this has been asked a million times, but I'm trying to do something with my .htaccess file and it's not working. I've read the tutorial that was posted here on this site, and I've done several searches of the site trying to find something that covers my particular example, but to no avail.

Here's what I'd like to do....

I want to redirect people from [xxx.com...] to [xxx.com...]

I haven't found any examples that seem to fit my scenario, so any help would be good.

I've tried this...

RewriteRule /yyy/$ /cgi-bin/zzz.cgi [R=301,L]

But it keeps saying 403, forbidden.

jdMorgan

5:06 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> I want to redirect people from [xxx.com...] to [xxx.com...]

Transparent redirect:


RewriteRule ^yyy/ /cgi-bin/zzz.cgi [L]

External redirect:

RewriteRule ^yyy/ http://www.xxx.com/cgi-bin/zzz.cgi [R=301,L]

If you still get a 403, then cgi-bin is protected, and that's a different issue.

HTH,
Jim

Donboy

5:53 pm on Jun 18, 2003 (gmt 0)

10+ Year Member



Hmmm... something must be wrong then. Here's what happens. I tried exactly what you are showing, but you see... under the yyy folder are directories for message boards. When I go to one of those boards and click on one of the links to message files, it takes me to /cgi-bin/zzz.cgi.

The links I'm clicking on (on the message boards) are specified with full URLs, so I don't understand what could be wrong. Any ideas?

jdMorgan

7:03 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In that case, put the end-anchor back on the pattern:

^yyy/$

Ref: Introduction to mod_rewrite [webmasterworld.com]

Jim

Donboy

1:53 pm on Jun 19, 2003 (gmt 0)

10+ Year Member



Ok, that worked! But I thought the whole idea of doing a "rewrite" is that you are rewriting the url that appears in the address bar. It's redirecting people just fine, but the URL in the address bar is still showing the old address. I don't want people to keep the wrong address bookmarked. If the url were showing up as the correct one in the address bar, it would at least give people an idea that the address has changed. Do I need to use redirect for that instead of rewrite?

Donboy

2:01 pm on Jun 19, 2003 (gmt 0)

10+ Year Member



Hmmm, nevermind. I think my browser cache was messing with me. I think it actually is rewriting the urls.