Remove Apostrophe or Quote from the URL
6 posts
• Page 1 of 1
Remove Apostrophe or Quote from the URL
Hello,
Is there any ISAPI rewrite code that can strip an apostrophe or quote out of the url in any place and rewrite the url with the apostrophe or quotes removed? If so, could you send me an example?
Thanks,
Shawn
Is there any ISAPI rewrite code that can strip an apostrophe or quote out of the url in any place and rewrite the url with the apostrophe or quotes removed? If so, could you send me an example?
Thanks,
Shawn
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Remove Apostrophe or Quote from the URL
Hello,
Please, take a look at our examples section, the first couple examples might be what you need - http://www.helicontech.com/isapi_rewrit ... amples.htm
Regards
Andrew
Please, take a look at our examples section, the first couple examples might be what you need - http://www.helicontech.com/isapi_rewrit ... amples.htm
Regards
Andrew
Re: Remove Apostrophe or Quote from the URL
Thank you Andrew, I looked through those examples but am not sure how to adapt it to our case. We would need to replace apostrophes or quotes with nothing, that is just remove them completely from the url. The apostrophe or quotes could be before the .aspx or after or at the end, I just need them out of the url.
Thanks!
Thanks!
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Remove Apostrophe or Quote from the URL
If you mean that you'd like to remove these characters from the body AND/OR the querystring, you'd probably use 2 rules:
Regards
Andrew
- Code: Select all
RewriteEngine on
RewriteBase /
#remove from the body of URL
RewriteRule ^([^']+)\'(.*)$ /$1$2 [NC,R=301,LP]
#remove from querystring
RewriteCond %{QUERY_STRING} ^([^']+)\'(.*)$ [NC]
RewriteRule (.*) /$1?%1%2? [NC,R=301,LP]
Regards
Andrew
Re: Remove Apostrophe or Quote from the URL
Thank you, when I place that code in my .htaccess file it seems to get my site frozen or stuck in a loop or something until I remove the code.
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Remove Apostrophe or Quote from the URL
Hm... can you take the first rule only and test it? LEts what happens.
It would be good, if you could provide the logs for the testing request. Logging issues are described in FAQ - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Andrew
It would be good, if you could provide the logs for the testing request. Logging issues are described in FAQ - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Andrew
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 21 guests