Lyleyboy Posted July 8, 2013 Share Posted July 8, 2013 Hey all, I have a site that uses mod rewrite. It's working fine for the main site.Now I need to build an admin panel and I'd like that to use mod re write too. So www.site.co.uk/controller/method works fine but www.site.co.uk/admin/controller/method breaks However www.site.co.uk/admin works fine. Admin is a folder that exists. My .htaccess looks like this RewriteEngine On RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ /index.php?id=$1 [L] Nothing fancy there. So what I have done is to add this same .htaccess file to the admin folder in the hopes that it would work. It hasn't. When you go to this page it just breaks because the first level doesn't see it as a controller and so fails. What can I do to make this work. Can I add something to the htaccess in the root to handle it. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/279963-using-mod-rewrite-in-root-and-then-a-subfolder/ Share on other sites More sharing options...
Lyleyboy Posted July 8, 2013 Author Share Posted July 8, 2013 Ok, I've fixed this now.All I needed to do is add the subfolder into the script inside the admin folder. RewriteEngine On RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ /admin/index.php?id=$1 [L] Link to comment https://forums.phpfreaks.com/topic/279963-using-mod-rewrite-in-root-and-then-a-subfolder/#findComment-1439919 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.