Removing multiple slashes
6 posts
• Page 1 of 1
Removing multiple slashes
Hi,
How can we use ISAPIRW 3 to remove multiple trailing slashes from URLs, like these for example:
http://www.ourdomain.com///
http://www.ourdomain.com///Folder/
http://www.ourdomain.com///Folder///
The URLs seem to work with the extra slashes, but how can we remove them so that /// becomes / ?
Advice appreciated, I could find no similar questions in the forum.
Thanks,
Mark
How can we use ISAPIRW 3 to remove multiple trailing slashes from URLs, like these for example:
http://www.ourdomain.com///
http://www.ourdomain.com///Folder/
http://www.ourdomain.com///Folder///
The URLs seem to work with the extra slashes, but how can we remove them so that /// becomes / ?
Advice appreciated, I could find no similar questions in the forum.
Thanks,
Mark
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Removing multiple slashes
Hello,
And there probably isn't one like this...
We can only try to play around like this:
So that it'd match anything before the first '/' and if it sees 2 or 3 of them it'd redirect. This would repeat in the loop until; nothing else is left.
Regards
And there probably isn't one like this...
We can only try to play around like this:
- Code: Select all
RewriteRule ^([^/]+)(:?/)?//(.+)$ /$1/$2 [NC,LP,L]
So that it'd match anything before the first '/' and if it sees 2 or 3 of them it'd redirect. This would repeat in the loop until; nothing else is left.
Regards
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Removing multiple slashes
Hi,
Could you, please, provide the rewrite.log for the testing request?
Logging issues are described in FAQ - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Could you, please, provide the rewrite.log for the testing request?
Logging issues are described in FAQ - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Re: Removing multiple slashes
Hi,
I enabled logging but nothing was saved. There is just an error log.
Your rewrite works in some cases:
http://www.ourdomain.com//folder/ NO
http://www.ourdomain.com///folder/ NO
http://www.ourdomain.com///folder WORKS!
So if there is a missing slash on end, it works, but middle of URL doesn't work.
Btw your own domain does it too:
http://www.helicontech.com///
http://www.helicontech.com///zoo/
etc
SEO audits pick up the multiple slashes immediately, so I am surprised this rewrite is not more commonly asked for - it's a basic requirement I'd say.
Many thanks,
Mark
I enabled logging but nothing was saved. There is just an error log.
Your rewrite works in some cases:
http://www.ourdomain.com//folder/ NO
http://www.ourdomain.com///folder/ NO
http://www.ourdomain.com///folder WORKS!
So if there is a missing slash on end, it works, but middle of URL doesn't work.
Btw your own domain does it too:
http://www.helicontech.com///
http://www.helicontech.com///zoo/
etc
SEO audits pick up the multiple slashes immediately, so I am surprised this rewrite is not more commonly asked for - it's a basic requirement I'd say.
Many thanks,
Mark
Re: Removing multiple slashes
I fixed it using code in the end, by scanning the CGI X_REWRITE_URL and then 301'ing to the correct URL with no slashes, works like a charm now and the SEO audit passes too I'd prefer a rewrite though!
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests