Jump to content

2 rewrite rules not working together


spiderwell

Recommended Posts

hi all,

 

i have researched this, and tried many variations to get this to work but it just doesnt seem to like it. I hopeing there is someone here who can fix this for me.

I am writing my own mvc system, more as an exercise than anything . i use rewrite to pass everything through the same file. that was all working fine.

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

</IfModule>

 

i wanted to add a rewrite for admin calls to go via a specific directory getting re written to a file called admin.php.

 

so to try and put in layman terms any call starts with www.mysite.com/a/ goes to www.mysite.com/admin.php

and anything else is covered by the original rewrite rule.

 

i tried this but it only seems to break it

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(a/.*) admin.php?url=$1 [PT,L]
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

</IfModule>

 

i spent ages on this and i know some genius out there can crack it for me in 5 mins!

 

thanks and HNE!

Link to comment
Share on other sites

i tried this

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(a/.*)$ admin.php?url=$1 [PT,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]


</IfModule>

it doesnt seem to to take any notice of it

Link to comment
Share on other sites

1. according to my hosts it does, but shot off a ticket just incase

2a. i went back to the single redirect on the live server as i know that works fine, it doesnt seem to redirect with this on the live site

2b. admin.php load up the display html only and nothing else.

 

i see what the hosts come back with first but im more inclinded to think its my htaccess only because i dont really know how to write it .

 

im still interesting in getting my original query working local too, with 2 redirects in place. its limiting my advancement, as im using the url to tell the controller script what to do /user/edit/?id=5 kinda thing 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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