I have been trying quite hard to get this to work, but I can't quite do it:
Basically, I want each subdirectory (up to three) of the root to be passed to the index.php page as a variable.
Here's a few examples:
- When a user browses to:
http://www.mysite.net/games
they are shown the contents of:
http://www.mysite.net/?dir=games
but the url shown in the address bar remains:
http://www.mysite.net/games
- When a user browses to:
http://www.mysite.net/apps/newapp/images
they are shown the contents of:
http://www.mysite.net/?dir=apps&subdir=newapp&subsubdir=images
but the url shown in the address bar remains:
http://www.mysite.net/apps/newapp/images
Here's my .htaccess file so far. The part in between the two "# TROUBLESOME" comments is the code that I have been trying to use to solve this problem. However, if you notice any problems/suggestions of improvement to other parts please let me know.
Any help is much appreciated!
Thankyou!
- Code: Select all
ErrorDocument 403 /error.php
ErrorDocument 404 /error.php
ErrorDocument 500 /error.php
# TROUBLESOME
RewriteEngine On
Options +FollowSymLinks
Rewritecond $1 !^files/
Rewritecond $1 !^forum/
Rewritecond $1 !^ftp/
Rewritecond $1 !^ictest/
Rewritecond $1 !^joomla/
Rewritecond $1 !^lolol/
Rewritecond $1 !^mail/
Rewritecond $1 !^pages/
Rewritecond $1 !^pnxi/
Rewritecond $1 !^ralphi/
Rewritecond $1 !^rapidleech/
Rewritecond $1 !^school/
Rewritecond $1 !^style/
RewriteRule ^(.*)\/(.*)\/(.*)$ ?dir=$2&subdir=$3&subsubdir=$4 [R=301]
# END TROUBLESOME
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite\.net [NC]
RewriteRule ^(.*)$ http://www.mysite.net/$1 [R=301]
# REDIRECT /folder/index.htm to /folder/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.htm\ HTTP/
Rewritecond $1 !^ftp/
Rewritecond $1 !^rapidleech/
Rewritecond $1 !^joomla/
RewriteRule ^(([^/]+/)*)index\.htm$ http://www.mysite.net/$1 [R=301,L]
#
# REDIRECT /folder/index.html to /folder/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.htm\ HTTP/
Rewritecond $1 !^ftp/
Rewritecond $1 !^rapidleech/
Rewritecond $1 !^joomla/
RewriteRule ^(([^/]+/)*)index\.html$ http://www.mysite.net/$1 [R=301,L]
#
# REDIRECT /folder/index.php to /folder/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
Rewritecond $1 !^ftp/
Rewritecond $1 !^rapidleech/
Rewritecond $1 !^joomla/
RewriteRule ^(([^/]+/)*)index\.php$ http://www.mysite.net/$1 [R=301,L]
#