You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dave Wreski <dw...@guardiandigital.com.INVALID> on 2024/06/20 23:01:58 UTC

[users@httpd] Removing single question mark?

Hi,

I have another challenging rewrite rule request, please. I'm trying to 
remove a single question mark from a URL:

https://example.com/?

I've tried the following:

RewriteRule ^/\?$ / [L,R=301,QSD]
RewriteRule ^/\? /? [L,R=301]

RewriteCond %{REQUEST_URI} ^$
RewriteRule ^ /? [L,R=301,QSD]

But it seems to ignore all of them. Ideas greatly appreciated.

Thanks,
Dave


Re: [users@httpd] Removing single question mark?

Posted by Eric Covener <co...@gmail.com>.
On Thu, Jun 20, 2024 at 7:08 PM Dave Wreski
<dw...@guardiandigital.com.invalid> wrote:

> Hi, I should add that I wrote the following to remove an errant question
> mark from the end of another URL, but it doesn't appear to work for the
> homepage.
>
> RewriteCond %{THE_REQUEST} /features\? [NC]
>
RewriteRule ^ %{REQUEST_URI} [L,R=302,NE,QSD]
>

I think %{THE_REQUEST} is the way to go. But what do you mean about "the
homepage" and how does it relate to /features in your regex?
Maybe you want something closer to this for a request with a trailing ?
and no actual query:
RewriteCond %{THE_REQUEST} "? HTTP/" [NC]

If it doesn't work, post rewrite:trace8 output.

Re: [users@httpd] Removing single question mark?

Posted by Dave Wreski <dw...@guardiandigital.com.INVALID>.
Hi, I should add that I wrote the following to remove an errant question 
mark from the end of another URL, but it doesn't appear to work for the 
homepage.

RewriteCond %{THE_REQUEST} /features\? [NC]
RewriteRule ^ %{REQUEST_URI} [L,R=302,NE,QSD]

Thanks,
Dave

On 6/20/24 7:01 PM, Dave Wreski wrote:
>
> Hi,
>
> I have another challenging rewrite rule request, please. I'm trying to 
> remove a single question mark from a URL:
>
> https://example.com/?
>
> I've tried the following:
>
> RewriteRule ^/\?$ / [L,R=301,QSD]
> RewriteRule ^/\? /? [L,R=301]
>
> RewriteCond %{REQUEST_URI} ^$
> RewriteRule ^ /? [L,R=301,QSD]
>
> But it seems to ignore all of them. Ideas greatly appreciated.
>
> Thanks,
> Dave
>
>
-- 

Profile Photo

	

Dave Wreski

Chief Executive Officer

	

Guardian Digital Logo <https://www.guardiandigital.com>

*We Make Email Safe For Business*

	

Guardian Digital Facebook <https://www.facebook.com/gdlinux> Guardian 
Digital Twitter <https://twitter.com/gdlinux> Guardian Digital Linkedin 
<https://www.linkedin.com/company/guardiandigital>

Phone Icon <tel:+16408009446>

	

(640)-800-9446 <tel:+16408009446>

	

Email Security

Web Icon <https://www.guardiandigital.com>

	

www.guardiandigital.com <https://www.guardiandigital.com>

	

Sender Fraud Protection

Email Icon <ma...@guardiandigital.com>

	

dwreski@guardiandigital.com

	

Training & Awareness

Location Icon <https://maps.app.goo.gl/aLZyUyCJznWoW1Jh8>

	

103 Godwin Ave, Suite 314, Midland Park, NJ 07432 
<https://maps.app.goo.gl/aLZyUyCJznWoW1Jh8>