I'm trying to get (as many people before me have) my url with a particular $_get variable to mod_rewrite into slashes.
the latest post i have used among many others to no avail;
My original Code (thanks to Prix) Which gives me - www.mydomain.com/Events?var=data:
Options +FollowSymLinks -MultiViews
RewriteEngine On
# To externally redirect /dir/foo.html to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.(html|phtml) [NC]
RewriteRule ^ %1/ [R=301,L]
# To internally forward /dir/foo to /dir/foo.html
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^([^/]*)/$ $1.html [L]
# To internally forward /dir/foo to /dir/foo.phtml
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.phtml -f
RewriteRule ^([^/]*)/$ $1.phtml [L]
The Code/s i have tried and none have worked:
RewriteRule /?([A-Za-z0-9_-]+)/?$ Events.php?e=$1 [QSA,L]
#RewriteRule ^Events/(.*)$ Events.phtml?Event=$1 [QSA,L]
#RewriteRule ^Events/(.*)$ Events?Event=$1 [QSA,L]
#RewriteRule ^/([^/]+)$ .phtml?$1=$2
#RewriteRule ^([^/]+)/([^/]+)$ Events.phtml?$1=$2 [L]
#RewriteRule ^Events/(.*)/?$ Events.phtml?p=$1
As you can see in simple form am trying to get www.mydomain.com/Events.phtml?Event=data
to rewrite to www.mydomain.com/Events/data
.
I'm getting there but still do not understand the code entirely, which is obviously why i cannot get it to work;
What am i doing wrong!
NOTE: - I am happy to use just one variable for all get variables that i may need to pass and parse with php. - Events is not the only page i would like to do this on. - It needs to work in subfolders so it works when demonstrating or developing in wamp localhost;