This forum has been moved here:
Helicon Tech Community Forum

Helicon Ape (Forum Locked Forum Locked)
 Helicon Tech : Helicon Ape
Subject Topic: remove double slashes
Author
Message |
ynyn999
Newbie


Joined: 09 November 2010
Posts: 4
Posted: 09 November 2010 at 1:33am

I can't seem to remove double slashes using APE, I'm using
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]

This is to redirect from
http://www.mydomain.com/sub1//sub2/file.aspx
to
http://www.mydomain.com/sub1/sub2/file.aspx

Thanks,
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 09 November 2010 at 2:12am

Please try to fix it the following way:

RewriteRule ^(.*)//(.*)$ $1/$2 [R=301,L]

If it still doesn't work, please enable rewrite.log in httpd.conf and provide rewrite.log records for the test request.

__________________
Regards,
Anton
Back to Top
 
ynyn999
Newbie


Joined: 09 November 2010
Posts: 4
Posted: 09 November 2010 at 4:34am

After enabling the log the first line handling the
response is:
init rewrite engine with /sub1/sub2/
where the URL I requested was /sub1//sub2/

I checked the HTTP_X_REWRITE_URL variable and the asp.net
request URL and they have only a single slash.

We are running IIS 7.5 on W2008 and this is the first
time I see this behavior.

Is there anything else you may recommend to resolve this
issue - these pages are indexed twice by search engines.

Thanks
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 09 November 2010 at 5:39am

The thing is that Ape gets the URL with one slash only (the IIS fixes it prior to Helicon Ape).
But we've found out how to deal with this and we'll release new build which handles it correctly in a few days.
I'll write to you as soon as it's ready.

__________________
Regards,
Anton
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 10 November 2010 at 2:57am

While we are considering how to fix this issue in our new build, please try the following solution:

RewriteCond %{HTTP_URL} ^(.*)//(.*)$
RewriteRule .? %1/%2 [R=301,L]

__________________
Regards,
Anton
Back to Top
 
ynyn999
Newbie


Joined: 09 November 2010
Posts: 4
Posted: 10 November 2010 at 3:26am

Thanks Anton, this rule fixed the double slashes problem!

Should I use the HTTP_URL rather than REQUEST_URI for
future cases?
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 10 November 2010 at 3:33am

"Should I use the HTTP_URL rather than REQUEST_URI for future cases?"
- if you need to get the originally requested URL, you should use HTTP_URL, and if you need URL obtained by Ape, it's REQUEST_URI.

__________________
Regards,
Anton
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version