0

I'm actually developping a small php website (only php, no java) and I would like to figure out something.

When I have this url called URL A: http://www.domain.com/?toto, everything's working I would like to rewrite it to http://www.domain.com/toto (called URL B) but when I tried, I have a 404 page not found.

What do I have to use to tell apache, when you have URL B it's an alias of URL A ??

It tried proxypass, Rewrite rules without reaching my aim. Can someone help me please?

Thx a lot !!!

Lord-Y
  • 132
  • 2
  • 8

1 Answers1

1

You need to use Apache's mod_rewrite.

A simple rewrite rule can be placed in your .htaccess file (untested):

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) /index.php?$1 [L]
Rob W
  • 9,134
  • 1
  • 30
  • 50
  • UPDATE: changed the `RewriteRule` - had it backwards (oops). – Rob W Jul 03 '13 at 21:56
  • I finally reach what I want to do and here is the result: # Rewrite for http://domain.com/index.php?action=11111 RewriteCond %{QUERY_STRING} ^(\w+)=(\w+)$ RewriteRule (.*)$ /%1/%2? [R=301,L] #Rewrite back RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ([^/]*)/([^/]*) /\?$1=$2 [END] – Lord-Y Jul 13 '13 at 00:50