/    Sign up×
Community /Pin to ProfileBookmark

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][/CODE]

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

[/QUOTE]

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.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@Phill_PaffordMay 16.2008 — I think it's the .*, this is the wild card. If you place the names you want to rewrite in place of the * this should work.
Copy linkTweet thisAlerts:
@PHPychoauthorJun 13.2008 — Hello forums!!

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.
×

Success!

Help @PHPycho spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...