Jump to content

Using mod rewrite in root and then a subfolder


Lyleyboy

Recommended Posts

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

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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.