Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

mod_rewrite in .htaccess to exclude a sub-directory.


Go to End


2 Posts   7065 Views

Avatar
Bruce

Community Member, 29 Posts

11 September 2008 at 9:09pm

Hi,
I know this is not a silverstripe-specific issue, but someone may have struck this.

I am wanting to make a modification to the mod_rewrite rules in the .htaccess file to prevent re-write engine from operating inside a sub-directory.

The situation is that the silverstripe content is in my base directory, and I am operating phplist (http://phplist.com) from a sub-directory.
The phplist application generally calls new pages in it's own directory with the directory name only, not a specific file name. (e.g. http;//<domain>/phplist//admin/?page=list )
These calls are unfortunately captured by the mod_rewite & a silverstripe page not found is returned.

I have tried various RewriteCond statements such as:
RewriteCond {REQUEST_URI} !^phplist
but don't seem to be able to get it right.

Avatar
Bruce

Community Member, 29 Posts

11 September 2008 at 10:10pm

Edited: 11/09/2008 10:12pm

Nothing like posting a question to sharpen the focus!

I have used the rule:

 RewriteCond %{REQUEST_URI} !/phplist* 

and it works fine!

The only drawback is that

 http://<domain>/phplist/admin/ 

works, but
 http://<domain>/phplist/admin 

doesn't ... the trailing slash is needed to get started.

//Bruce