for example:
www.site.com/your/blue
will redirect to... www.site.com/your/index.php?=blue
right now when someone types in www.site.com/your/blue it throws an error saying page does not exist. can anyone help me with this? thank you in advance.
for example:
www.site.com/your/blue
will redirect to... www.site.com/your/index.php?=blue
right now when someone types in www.site.com/your/blue it throws an error saying page does not exist. can anyone help me with this? thank you in advance.
Mod rewrite has to be used for this kind of redirects:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/?$ $1/index.php?page=$2 [L]
</IfModule>
This regex ensures a clean url is being passed to the site and works with or without a ending slash.
NB: Parameters passed to PHP need to have a name so I added page=
If you want it to work without any restriction (spaces will work)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^([^/]+)/([^/]+)/?$ $1/index.php?page=$2 [L]
</IfModule>