Say a direct link is: www.mywebsite.com/index.php?locate=register where in my functions.php if locate=register include regsiter.php anyone know how to just have it as: www.mywebsite.com/register? Thanks
RewriteEngine On RewriteRule ^register$ index.php?locate=register Code (markup): Save this as .htaccess in the same directory as index.php.
Hey nico - thanks very much for the reply. will this produce http://mywebsite.com/register ? Whats the ^register$ for? Will I save it as "register.htaccess" or what? Anything else need doing? Thanks again
No, save it as .htaccess, as I said. ^register$ is a pattern, that if matched, it will rewrite the URL to the wanted page. Just try it...
I did try it and it worked! Man you are superb! Thanks very much indeed! Do I ever need to set rewriteEngine Off? Also can I now add more in such as: RewriteRule ^register$ index.php?locate=register RewriteRule ^search$ index.php?locate=search etc?
Yes you can. Either like you did above, or if you have multiple rewrites pointing to the same file, you can do: RewriteEngine On RewriteRule ^(register|search|etc|etc)$ index.php?locate=$1 Code (markup):
$1 should that not be register? I found this on the net but I think yours is much easier to read and understand! RewriteEngine on Options +FollowSymlinks RewriteBase / RewriteRule ^([^/]+)/?$ index.php?local=$1 [QSA,L] # files in home dir only