+Kyle Subscriber¹ Posted March 5, 2010 Subscriber¹ Share Posted March 5, 2010 This is what I have now in my htaccess: RewriteEngine On RewriteRule ^([^/]*)/$ /l.php?l=$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !\..+$ RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) http://www.tld.com/$1/ [R=301,L] but I have an admin panel and everytime I go to tld.com/admin it automatically looks for a page like l.php?l=admin Can someone fix my .htaccess to allow me to go to /admin/ it lets me go through? =[ Link to comment Share on other sites More sharing options...
0 Hot Posted March 6, 2010 Share Posted March 6, 2010 Add this to your list of conditions, I think. RewriteCond %{REQUEST_URI} !^/admin.*$ +Kyle 1 Share Link to comment Share on other sites More sharing options...
0 Calculator Posted March 6, 2010 Share Posted March 6, 2010 You might want to use this as well: RewriteCond %{REQUEST_FILENAME} !-d You already have a !-d condition which will prevent real file paths from being rewritten, and with this extra line you can prevent real directory paths to be rewritten as well. That should make it easier for you to maintain the .htaccess file, otherwise you'd need to update it every time you add a directory. However, if your /admin/ folder is not really at that location (most hosting providers put it outside the htdocs) you'll still need a custom regular expression to specifically prevent certain paths from being rewritten, such as the condition Hot posted above. +Kyle 1 Share Link to comment Share on other sites More sharing options...
0 +Kyle Subscriber¹ Posted March 6, 2010 Author Subscriber¹ Share Posted March 6, 2010 Alright thanks guys. Both worked. Rep +1! Link to comment Share on other sites More sharing options...
Question
+Kyle Subscriber¹
This is what I have now in my htaccess:
RewriteEngine On RewriteRule ^([^/]*)/$ /l.php?l=$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !\..+$ RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) http://www.tld.com/$1/ [R=301,L]but I have an admin panel and everytime I go to tld.com/admin it automatically looks for a page like l.php?l=admin
Can someone fix my .htaccess to allow me to go to /admin/ it lets me go through?
=[
Link to comment
Share on other sites
3 answers to this question
Recommended Posts