Reputation: 1012
Could someone please help me with the following re-writes for Apache I want the results to be:
domain.com/ (Landing search page for which DB username belongs to)
domain.com/db1/ (For index login page to db1 where db1 can be any other db name)
domain.com/db1/accounts/ (Once logged in)
domain.com/db1/admin/ (Another page once logged in)
Please help me with a url re-write
if it is possible to do this...
I have something like this but it's not working:
`Options +FollowSymLinks
RewriteEngine on
RewriteRule /(.*)/$ /index.php?dbname=$1
RewriteRule /(.*)/account/$ /account.php?dbname=$1 `
Thank you
Regards Johan
Upvotes: 0
Views: 31
Reputation: 1190
Avoid rewriting calls to /
Just present the login form in index or in whatever other page you want.
Then
This block tells the server to allow rewriting, to stick with existing files and directories and only rewrite what does not "exist", and that you will be rewriting from /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteBase /
then your rules
RewriteRule ^db([0-9]+)$ index.php?dbname=$1&%{QUERY_STRING} [L]
RewriteRule ^db([0-9]+)/account$ index.php?admin=$1&%{QUERY_STRING} [L]
RewriteRule ^db([0-9]+)/admin$ index.php?admin=$1&%{QUERY_STRING} [L]
This is assuming that after login you will be sending him to
https://www.yoursite.com/db1
https://www.yoursite.com/db1/account
https://www.yoursite.com/db1/admin
for instance
Upvotes: 1