I am trying to find out how to do something like this in htaccess:
#This address links to a place that does not exist
localhost/prefix/games/userid/game-name
to silently ([L], i guess) redirect to
#This folder has an index.php, so we're good!
localhost/prefix/protected/files/userid/game-name/
I realise I can have a link:
localhost/prefix/games/index.php?user=userid&title=game-name
And just have the index.php have some redirect put in…
But I don’t want the url paramaters visible in a link on my website… So I guess it really does need to be htaccess.
I’ve got to admit, I read that htaccess stuff and it goes right past my head because noone has explained in a way I understand.
any help would be greatly appreciated.
EDIT::///
RewriteEngine On
RewriteBase /prefix
# stop directory listings
Options -Indexes
#stops htaccess views
<Files .htaccess>
order allow,deny
deny from all
</Files>
# remove .php; use THE_REQUEST to prevent infinite loops
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP
RewriteRule (.*)\.php$ $1 [R=301]
# remove index
RewriteRule (.*)/index$ $1/ [R=301]
# remove slash if not directory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*)/ $1 [R=301]
# add .php to access file, but don't redirect
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
# redirect game folders
RewriteRule ^prefix/games/(.*)$ /prefix/protected/files/$1/ [R=301]
You can have
to redirect all
http://localhost/prefix/games/userid/game-namelinks tohttp://localhost/prefix/protected/files/userid/game-nameor, you can have
to move all links like:
http://localhost/prefix/games/index.php?user=userid&title=game-nametohttp://localhost/prefix/protected/files/userid/game-name