really really basic htaccess question

really really basic htaccess question

Posted by: danielsherson
Posted on: 2008-02-29 20:35:00

I'm just starting out with .htaccess and ive been struck what is probably a really basic problem. :)

I have the .htaccess file in the site directory (the same level as that site's index file) and just to make sure i could do the right thing I wrote this thing I wrote

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)w/$ $1v/ [R]

thinking it will take "http://www.example.com/w/" and go to "http://www.example.com/v/" It actually goes to "http://www.example.com/home/~user/www.example.com/v/"

which is not what I expected at all.

is there something wrong with the basic ideas of my regex? do i need more in my .htaccess file? is its placement wrong?

Thanks in advance for your assistance.

Re: really really basic htaccess question

Posted by: Atropos7
Posted on: 2008-03-01 07:34:00

Try

Options  FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)w/$ $1v/ [R]

The RewriteBase tells mod_rewrite the base url-path prefix to reinsert. Also, there is no leading / in the URL when you get to RewriteRule:


URL = w/

$1 = (null)

Substitution = v/

oops, v/ is not a URL. So it had to make it a URL, but we don't have a base so we use the document root instead, /home/username/domain/

cool openvein.org -//- One-time $50.00 discount on DreamHost plans: Use ATROPOS7Edited by Atropos7 on 03/01/08 07:38 AM (server time).

Tags: index filerewriterulehtaccess fileregexthanks in advanceindex filerewriterulehtaccess fileregexthanks in advance