Forum Moderators: phranque

Message Too Old, No Replies

Doubt about RewriteRule: it won't mask, but redirect

         

guarriman

6:32 pm on Sep 8, 2005 (gmt 0)

10+ Year Member



Hi.

With Apache/2.0.52 on my server, I want to convert
[mydomain.com...]
into
[mydomain.com...]
with RewriteRule

I modified my 'httpd.conf':

-----------
<VirtualHost mydomain.com:80>
ServerAdmin john@mydomain.com
DocumentRoot "/home/mydomain/web"
ServerName www.mydomain.com
ErrorLog logs/mydomain-error_log
CustomLog logs/mydomain-access_log "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
DirectoryIndex index.php
RewriteEngine On
RewriteRule ^/([0-9]+)/([0-9]+)/([0-9]+)/(.*) [mydomain.com...] [QSA,L]
<Directory "/home/mydomain/web">
Options Indexes +FollowSymLinks
</Directory>
</VirtualHost>
-------

(/home/mydomain/web/index.php is a soft link to /home/foo/index.php)

But when trying to access to:
[mydomain.com...]
it redirects to:
[mydomain.com...]
and doesn't mask it, as I supposed. I mean, I can see this URL on my browser.

Whay am I doing wrong? Thank you very much.

jd01

7:26 pm on Sep 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to use a relative URL for internal ('silent') rewrites, not a full canonical URL:

index.php/$1/$2/$3/$4

Rule of thumb:
If it should be seen (redirect) use a canonical URL

If it should be silent (rewrite) use a relative URL

Justin

guarriman

8:02 am on Sep 9, 2005 (gmt 0)

10+ Year Member



Cool. It works.

Thank you very much for your help