[users@httpd] Extra garbage in URL when using mod_rewrite with redirects

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

 



Hi,
  I have the following rewrite rules in my site's .htaccess:

--- begin cut

RewriteEngine On

# Only rewrite URLs on the primary domain, not subdomains
RewriteCond %{HTTP_HOST} ^www\.philpem\.me\.uk$  [OR]
RewriteCond %{HTTP_HOST} ^philpem\.me\.uk$

# This makes sure AWStats can get through
RewriteCond %{REQUEST_URI} !^/awstats.* [NC]

# page manager
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^(.*)$ index.php?$1 [L]

-- end cut

The problem is, a few other sites are linking to my site using old URLs (www.philpem.me.uk/forum, for example is now forum.philpem.me.uk). To get around this, I've added this rule to my htaccess:

RedirectPermanent /forum http://forum.philpem.me.uk
RedirectPermanent /blog http://blog.philpem.me.uk

My problem is that when the redirect is triggered by someone going to http://www.philpem.me.uk/forum/, instead of being redirected to http://forum.philpem.me.uk/, they're redirected to http://forum.philpem.me.uk//?forum/. Similarly, /blog redirects to http://blog.philpem.me.uk/?blog/.

Although the stuff after the ? is pretty benign (the scripts in those directories just ignore it), for the sake of URL tidiness I'd like to get rid of it. Can anyone tell me what I need to add to my htaccess to do that?

Thanks.
--
Phil.                         |  (\_/)  This is Bunny. Copy and paste Bunny
usenet06@xxxxxxxxxxxxx        | (='.'=) into your signature to help him gain
http://www.philpem.me.uk/     | (")_(") world domination.
If mail bounces, replace "06" with the last two digits of the current year.


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