RE: [users@httpd] mod_rewrite

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

 



Seems almost right to me. If you want the querystring appended, you need to use the QSA option. The L is not necessary since the redirect is immediate.

RewriteRule ^/directoryone/directorytwo/(mypage\.php)$ /$1 [R=301,QSA]


-ascs

-----Original Message-----
From: Robert Ionescu [mailto:robsiegen@xxxxxxxxxxxxxx] 
Sent: Wednesday, May 24, 2006 8:31 PM
To: users@xxxxxxxxxxxxxxxx
Subject: Re: [users@httpd] mod_rewrite

Bob Smith wrote:
> I'm trying to remove two directories from the path of a website, but I 
> just can't seem to get the mod_rewrite syntax right.
> 
> I have a url coming in with a url like 
> http://www.mysite.com/directoryone/directorytwo/mypage.php?key=value
> 
> And I'm trying to redirect it to 
> http://www.mysite.com/mypage.php?key=value

Are your directories constants? Or are they some kind variable?

To force such an external redirect, you could use in your httpd.conf

RewriteRule ^/directoryone/directorytwo/(mypage\.php)$ /$1 [R=301,L]

--
Robert

---------------------------------------------------------------------
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