Re: How to mask an URL with .htaccess

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/09/2007, thomas Armstrong <tarmstrong@xxxxxxxxx> wrote:
> I want to make http://mysite.com/post/004.htm -->
> http://mysite.com/post.php?id=004
> but not redirecting but masking the URL (the first URL must be shown
> and not the second one).
>
> My .httaccess:
> --------------------------
> RewriteEngine On
> RewriteBase /
> DirectoryIndex index.php index.html
> RewriteRule ^post/(.*).htm post.php?id=$1 [R=301,L]
> ---------------------------

Clearly you don't want this one as [R] does the opposite of what you're asking.

> I also tried with:
> RewriteRule ^post/(.*).htm post.php?id=$1 **whithout R,L**
> I got this URL: http://mysite.com/post.php/005.htm?id=005
>
> I also tried with
> RewriteRule ^post/(.*).htm post.php?id=$1 [L]
> I got this URL: http://mysite.com/post.php?id=005

These two look fine. If the browser is still being redirected, it
could be that your script is doing the redirect. One way to tell would
be to watch the http headers during the redirect and see if php
advertises itself (x-Powered-By or whatever it is) on the 3xx
response.

http://wiki.apache.org/httpd/WatchingHttpHeaders

> I also tried with
> RewriteRule ^post/(.*).htm http://mysite.com/post.php?id=$1 [L]
> I got this URL: http://mysite.com//post.php/005.htm?id=005

This one is equivalent to the first, because using a full url in the
target implies a 3xx redirect.

-- 
noodl

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux