I am trying to create a rewrite rule in my Apache .htaccess file and the goal is:
http://domain/folder/(any search string) to redirect to http://domain/folder/index.php?option=$1
example:
http://domain/folder/covid to redirect to http://domain/folder/index.php?option=covid
I got this setup in htacess in http://domain/folder, but somehow it’s not working:
RewriteEngine On
RewriteRule ^([^/folder]+)/([^/]+)$ http://domain/folder/index.php?option=$1 [L]
The website is hosted on http://domain/folder
Can someone help me on this?
2
Answers
You could have your htaccess file like as follows. Please keep your htaccess file along side with your folder(named
folder
) and NOT inside folder.Please make sure you clear your browser cache before testing your URLs.
OR in case your htaccess is present inside folder
folder
then try following.You may try this .htaccess inside
folder/
: