.htaccess beginner


#1

Question 1: can I just edit the .htaccess file where my site is stored (hosted) to do redirects?

Question 2: if so, why isn’t it working? I’ve done the following:

in my .htaccess file with no success. What am I missing?


#2

You almost had it! The first half should work with just Redirect permanent /eventtest, as shown in this example: http://wiki.dreamhost.com/Permanently_renaming_a_file_or_directory

Alternatively, you can use a PHP redirect for the same sort situation: http://wiki.dreamhost.com/PHP_Redirect

Cedric H
Dreamhost staff


#3

Ok, well I tried the first option as follows:

BEGIN WordPress

Redirect permanent /?page_id=9 http://www.adventuresnw.com/events

END WordPress

But it seems to screw up every link on the site - NONE of my links work when this .htaccess file has been uploaded. Does it have to do with the question mark or something?

UPDATE

Well, it appears to be moot. In WordPress it looks like even if I change to clean URLs, the old URL will automatically redirect. Still curious why it didn’t work though…


#4

The ? usually isn’t a problem.

That said, with WP you never need to redirect the ?page_id… stuff. WP always does it for you. So if you wanted to force /eventtest/ to a different URL, it’s like this:

Redirect 301 /eventtest/ /?page_id=9

But make sure you always put your redirects like that above the WordPress calls :slight_smile: So before “# BEGIN WordPress” :slight_smile: