I have a .htaccess in the root of my public_html site, but I need some assistance with it. What it's set to do is use this as the "fake link": 'http://website.com/home', but have it really show this: 'http://website.com/request.php?req=home'.
The URL shows the first link and uses the second basically.
Here is the .htaccess file:
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ request.php?req=$1 [NC,L]
DirectoryIndex request.php?req=home
The problem is the DirectoryIndex. Whenever i go to website.com it should go to the home by default, but it just shows the file index (allowing the user to see all the files in the public_html folder).
One other problem is I have a forum running on a subdomain (
http://forum.website.com) and it does the same thing because of the .htaccess file in the parent folder, so I need the file t ignore folder 'forum'.
I found this on Google and tried it but it didn't seem to work:
Code:
=========[ start of .htaccess snippet]==========
<IfModule mod_rewrite.c>
RewriteEngine on
#
# stuff to let through (ignore)
RewriteCond %{REQUEST_URI} "/folder1/" [OR]
RewriteCond %{REQUEST_URI} "/folder2/"
RewriteRule (.*) $1 [L]
#
====================[ end ]=====================
How I added it:
Code:
RewriteEngine On
RewriteCond %{REQUEST_URI} "/forum/"
RewriteRule (.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ request.php?req=$1 [NC,L]
DirectoryIndex request.php?req=home
Any assistance is appreciated! Also, the original .htaccess worked when my friend used it on his site so I think it may be a problem with the webhost or something else.