Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Posts
    217
    Thanks
    1
    Thanked 0 Times in 0 Posts

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

  • #2
    Regular Coder
    Join Date
    Apr 2008
    Location
    New Jersey
    Posts
    116
    Thanks
    0
    Thanked 29 Times in 29 Posts
    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

  • #3
    Regular Coder
    Join Date
    Dec 2005
    Posts
    217
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Regular Coder
    Join Date
    Apr 2008
    Location
    New Jersey
    Posts
    116
    Thanks
    0
    Thanked 29 Times in 29 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •