-4

I have looked all over the Internet trying to find an answer to this question but none of them seem to work or be what I want. What I want is to make my website understand http://example.com/asd means http://example.com/?q=asd, while not changing the link. So the user will see http://example.com/asd, but it will be a GET with ?q=asd in the background.

Basically, I want the user to be redirected to http://example.com/?q=asd, without redirecting their address bar to that.

For example, http://example.com/asd -> means -> http://example.com/?q=asd, but the address bar looks like http://example.com/asd.

Please comment if you have any questions.

Obsidian Age
  • 36,816
  • 9
  • 39
  • 58
DrBrad
  • 166
  • 1
  • 13
  • you want http/ to be instead of http:// too? correct me if i'm wrong but i doubt that's possible, http is a protocol and not something you can edit i guess, for the /asd instead of /?q=asd i can help you if you want but not with http/ for sure – roun512 Mar 15 '17 at 20:19
  • There are about 674783047659 answers to this question alone here on SO. None of all those answers helped, you claim. May we ask _why_ not? And why a 674783047660th answer we write should make a difference? (read: _you did not do your homework..._) – arkascha Mar 15 '17 at 20:21
  • 1
    http://stackoverflow.com/questions/34240786/htaccess-redirect-using-get-parameters – bassxzero Mar 15 '17 at 20:21
  • I did http/ rather than http:// due to stack overflow rules and I want /asd to be ?q=asd while the address bar link still being /asd – DrBrad Mar 15 '17 at 20:23
  • arkascha I did do my homework I have been attempting this for over a week, I'm not sure if this is even possible. – DrBrad Mar 15 '17 at 20:25
  • I don't see why this is not doable by the most simple rewrite rule shown in those 674783047659 questions... But maybe you can tell us why your case is different? (Apart from "does not work"...) – arkascha Mar 15 '17 at 20:26
  • It's definitely possible! I know it's easy to get discouraged when something just won't seem to work, but you'll get there. Can you improve your question by showing the code you're using for the attempt that got you the closest, and what the result of that was? Without a specific example, your question is generic enough that it is answered appropriately by the general reference question that I linked. – Don't Panic Mar 15 '17 at 20:28
  • I'm sure there isn't 64 Billion questions for the same thing. I do not want the link to be modified in the address bar unlike some answers, as well as the link still acting as a get. I understand this may be achieved with a 404 error but it doesn't seem like a good way to do this. – DrBrad Mar 15 '17 at 20:30
  • There certainly aren't that many. The front page of Stack Overflow currently says "13,491,423 Questions". And I'm sure that at least half of those are asking what undefined index means. – Don't Panic Mar 15 '17 at 20:39
  • @Don'tPanic That was a good one ;-) – arkascha Mar 15 '17 at 20:42
  • I doubt half of them say that, either way its not the 64 Billion you stated earlier. @bassxzero thank you for your answer but it sadly doesnt work due to the fact that the GET isn't moved. – DrBrad Mar 15 '17 at 20:43
  • "I have looked all over the Internet", "the fact that the GET isn't moved", "may be achieved with a 404 error"... Can it be that you have no idea what you are talking about? – arkascha Mar 15 '17 at 20:46

1 Answers1

-1
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?q=$1 [QSA,L]
A. El-zahaby
  • 957
  • 8
  • 27