Forum Moderators: phranque

Message Too Old, No Replies

htaccess redirect, need clean URL

Keeps passing double slash and query string

         

mm93

1:15 am on Mar 12, 2006 (gmt 0)



This is my htaccess located at domain1.com/members
=================
RewriteEngine On
Redirect /members [domain2.com...]
ErrorDocument 404 [domain2.com...]
==================

The problem is when a user has a bookmark or goes to a page indexed by a search engine like:
[domain1.com...]

the redirect happens but it appends a double slash and the rest of the query string which so it ends up looking like this:

[domain2.com...]

This breaks the destination so how can I force everything thing under /members to go to the one clean domain2.com/somefldr/ (with only one trailing slash)

Thanks for any direction you could offer!

jdMorgan

6:18 pm on Mar 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's passing a double-slash because of your code:

Redirect /members http://www.domain2.com/somefldr/

Use either

Redirect /membe[b]rs/ h[/b]ttp://www.domain2.com/somefldr/

-or-

Redirect /members http://www.domain2.com/somef[b]ldr[/b]

Any part of the requested URL not specified in the left-hand prefix-pattern of a Redirect directive will be 'copied' to the end of the right-hand substitution URL. Therefore, your code explicitly adds an additional slash. See Apache mod_alias [httpd.apache.org] for more information.

Jim