Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-14-2008, 07:00 AM   PM User | #1
PHPycho
Regular Coder

 
Join Date: Dec 2005
Posts: 217
Thanks: 1
Thanked 0 Times in 0 Posts
PHPycho has a little shameless behaviour in the past
url rewrite regex help ??

Hello forums
I have some problem regarding regex in url rewriting.
case:
.htaccess
Code:
Options -Indexes
Options +FollowSymlinks

RewriteEngine on
RewriteRule ^admin/(.*)$ admin_$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
# Main URL rewriting.
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
Everything works fine except for admin part.
When admin/any_text comes in url, it routes to admin_any_text. but i want resitriction in some cases as i have folder structure for admin as:
Quote:
-admin
--js
--themes
---default
----images
----css
I want to modify rule: RewriteRule ^admin/(.*)$ admin_$1 [L] so that it doesn't rewrite for admin/js,admin/themes
How to accomplish this ?
Thanks in advance for the valueable suggestions.
PHPycho is offline   Reply With Quote
Old 05-14-2008, 05:00 PM   PM User | #2
chaosprime
Regular Coder

 
Join Date: Apr 2008
Location: New Jersey
Posts: 116
Thanks: 0
Thanked 29 Times in 29 Posts
chaosprime is an unknown quantity at this point
You can add a RewriteRule before your main admin one like this:

Code:
RewriteRule ^admin/(js|themes) - [L]
RewriteRule ^admin/(.*)$ admin_$1 [L]
That will specify no rewrite for the matched pattern, terminating rewriting using [L].
__________________
Chaos
Lost Souls: text based RPG | MUDseek: MUD gaming search | MUDfind: MUD resource sites | Discordian Quotes
chaosprime is offline   Reply With Quote
Old 06-13-2008, 07:18 AM   PM User | #3
PHPycho
Regular Coder

 
Join Date: Dec 2005
Posts: 217
Thanks: 1
Thanked 0 Times in 0 Posts
PHPycho has a little shameless behaviour in the past
I am reopening this thread because this regex didn't worked in live server
though it worked perfectly in localhost.
In the live server apache is V1.3. I think the regex is not running its because of assertion type.
The error shown by the server is compilation error.
Is there any alternatives for this regex that doent use assertion.

Thanks in advance for the valueable help.
PHPycho is offline   Reply With Quote
Old 06-13-2008, 04:33 PM   PM User | #4
chaosprime
Regular Coder

 
Join Date: Apr 2008
Location: New Jersey
Posts: 116
Thanks: 0
Thanked 29 Times in 29 Posts
chaosprime is an unknown quantity at this point
I have no idea what 'assertion' you're talking about. Nothing discussed is an assertion in any sense I understand the term.

Maybe it would be helpful if you pasted the actual error output from the server.
__________________
Chaos
Lost Souls: text based RPG | MUDseek: MUD gaming search | MUDfind: MUD resource sites | Discordian Quotes
chaosprime is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:30 AM.


Advertisement
Log in to turn off these ads.