Lyleyboy Posted July 8, 2013 Share Posted July 8, 2013 (edited) 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 Edited July 8, 2013 by Lyleyboy Quote 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...
Solution Lyleyboy Posted July 8, 2013 Author Solution 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] Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.