...

View Full Version : .htaccess rewrite url



rndilger
07-18-2007, 03:14 PM
Hello. I have a quick question regarding url rewriting. I've been successful at using regular expressions in the past, but this one (though simple) has me stumped.

I'd like to make links throughout the site look like this:

http://www.indianasheep.com/membership

However, the php file is actually located at:

http://www.indianasheep.com/pages/membership.php

Thus, a simple redirect is in order, but I'm unable to get the syntax correct. Here is what I currently have:

RewriteRule ^([A-Za-z]+)?$ /pages/$1.php

And the .htaccess file is located in the pages directory.

Can anyone provide assistance?

Thanks,

Ryan

Fumigator
07-18-2007, 06:40 PM
I'm thinking you need to store the .htaccess file in your base directory, but I'm no expert at mod rewrite.

rndilger
07-19-2007, 02:26 AM
Thanks, that fixed the problem. But now I've got another url rewrite problem. After supplementing the last code, I attempted to do this on another page: www.rndpig.com. In this case, I can type www.rndpig.com/about into the address bar and it will take me to the correct page. The actual page address is www.rndpig.com/pages/about.php. However, when I changed links on the site to www.rndpig.com/about the links failed.

What could be causing the difference in typing the address into the address bar and clicking on a link that goes to the same address?

Any help would be appreciated.

Thanks,

Ryan



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum