I currently use $_GET['base']
to determine which homepage that the user visits.
This results in localhost/?base=administrator
or localhost/?base=guest
I am also using this to control which page is the user at, such as
localhost/?base=guest&page=register
Is there any way to use mod_rewrite, or htaccess, to change how this system works? Modifying my code is not an issue, is this possible?
EDIT:
I am trying to achive this:
localhost/?base=guest
to localhost/guest
localhost/?base=admin
to localhost/admin
localhost/?base=guest&page=register
to localhost/guest/register
Below is my htaccess file
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /?base=$1&page=$2 [L]
RewriteRule ^([^/]*)$ /?base=$1 [L]
Will the document path affect how it is being called? As I am using a case
loop to include which items are needed.
This, however, works for localhost
, but it will loop every other address to main.
RewriteEngine On
RewriteRule ^$ /index.php?base=guest[L]
But did not give a result as expected.
.htaccess
/mod_rewrite
are often used to redirect / send people different places depending on parameters in the URL.localhost/guest/register
to redirectlocalhost/?base=guest&page=register
something like this