Placing a Question Mark at the end of a URL with mod_rewrite or something else?


#1

Hello Dreamhost Tech Forum,

Looking for some expert advice since I am very new to this and does not understand if this is even possible, I got something working but it was stuck in an unending loop.

Say for example sake I have a website on Dreamhost say:

http://canyoudothis.com or http://www.canyoudothis.com

And say I wanted there to be some sort of rewrite rule that made anybody that visited the www. or root of the domain to look like this:

http://canyoudothis.com/?

Notice the Question Mark at the end of the URL.

I tried this command but got stuck in a unending loop, I even setup a directory called “/?/” but that did not seem to solve anything

..

I also tried this but Nothing happens when I placed this in the …htaccess file on the root of the website on Dreamhost

Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.)$
RewriteRule ^(.
)$ http://canyoudothis.com/?/$1 [R=301,L]

Is it possible not to get stuck in a Unending Loop and have the redirect with a Question Mark at the end of the URL?

Thanks


#2

Could you explain why you want to do this and what you are trying to accomplish? The ? symbol in the URL has a special meaning to indicate the beginning of a query string which is automatically handled separately to the URL.


#3

You need to add a condition that checks if /? was passed versus /

The Refresh header won’t cut it. And this is a bit ridiculous since you will make the web browser hit your web site twice just for kicks.