Reputation: 321
I'm having problems with my URL. My urls are modrewrited and until now I didn't know that I can access stuff in url only when there is & ( question-mark with $_GET don't work ).
So for example www.example.com/?go=1 $_GET['go'] not 1 But if I make it like this www.example.com/&go=1 then it works.
I want question-mark to work. What am I missing?
here is my .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?s=$1 [L]
Upvotes: 0
Views: 78
Reputation: 39981
You are rewriting everything
^(.*)$ /index.php?s=$1
so your successful request to &go=1 gets rewritten as /index.php?s=&go=1 and that is a valid request.
Your bad request to ?go=1 gets rewritten as /index.php?s=?go=1 and that is not valid
Upvotes: 2
Reputation: 36956
You could use the QSA flag:
RewriteRule ^(.*)$ /index.php?s=$1 [L,QSA]
Upvotes: 3
Reputation: 18271
Change last rule to:
RewriteRule ^(.*)$ /index.php?s=$1&%{QUERY_STRING} [L]
Upvotes: 2