Remove Apostrophe or Quote from the URL

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 18
Joined: 06 Apr 2012, 23:12

Remove Apostrophe or Quote from the URL

31 Aug 2013, 12:03

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

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Remove Apostrophe or Quote from the URL

02 Sep 2013, 01:53

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

User avatar
Posts: 18
Joined: 06 Apr 2012, 23:12

Re: Remove Apostrophe or Quote from the URL

02 Sep 2013, 11:17

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!

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Remove Apostrophe or Quote from the URL

02 Sep 2013, 17:45

If you mean that you'd like to remove these characters from the body AND/OR the querystring, you'd probably use 2 rules:

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

User avatar
Posts: 18
Joined: 06 Apr 2012, 23:12

Re: Remove Apostrophe or Quote from the URL

05 Sep 2013, 10:56

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.

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Remove Apostrophe or Quote from the URL

05 Sep 2013, 21:21

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

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 21 guests