Current time: 04-24-2014, 09:23 AM Hello There, Guest! (LoginRegister)

Post Reply 
Placing a Question Mark at the end of a URL with mod_rewrite or something else?
03-16-2012, 08:31 PM (This post was last modified: 03-16-2012 08:34 PM by canyoudothis.)
Post: #1
Placing a Question Mark at the end of a URL with mod_rewrite or something else?
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
...
<meta http-equiv="REFRESH" content="0;url=http://canyoudothis.com/?"></HEAD>
..

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
Find all posts by this user
Quote this message in a reply
03-16-2012, 10:09 PM
Post: #2
RE: Placing a Question Mark at the end of a URL with mod_rewrite or something else?
(03-16-2012 08:31 PM)canyoudothis Wrote:  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
...
<meta http-equiv="REFRESH" content="0;url=http://canyoudothis.com/?"></HEAD>
..

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

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.
Find all posts by this user
Quote this message in a reply
03-16-2012, 10:57 PM (This post was last modified: 03-16-2012 10:59 PM by Atropos7.)
Post: #3
RE: Placing a Question Mark at the end of a URL with mod_rewrite or something else?
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.

Customer since 2000 Cool openvein.org | Please don't feed the trolls. Angry
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: