GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 21-Jun-2003, 03:58
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road

RewriteRule


I have just read the article http://www.desilva.biz/apache/rewritedir.html about the RewriteRule. However can anybody tell me how I should rewrite additional levels?
My pages are recalled using
first level
index.php?opt=

second level
index.php?opt=pages&id=

and third level by
index.php?opt=pages&id=&par=

How would I write the second and third levels?
  #2  
Old 21-Jun-2003, 06:15
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough

Multiple query string Apache rewrite rule


Hello misunderstood,

It's been a while since I figured out my last mod rewrite rule but try this for a possible immediate solution.

Code:
RewriteEngine on RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [L] RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ index.php?opt=$1&id=$2&par=$3 [L] RewriteRule ^([^/]+)/([^/]+)/$ index.php?opt=$1&id=$2 [L] RewriteRule ^([^/]+)/$ index.php?opt=$1 [L]

Let me know if it doesn't do the job... we may need to fine-tune it yet.

Your html / links should look like this...

HTML Code:
<li><a href="/pages/">Pages Link</a></li> <li><a href="/pages/23/">ID 23</a></li> <li><a href="/pages/2/">ID 2</a></li> <li><a href="/pages/2/something/">Something in pages-2-something</a></li>
  #3  
Old 21-Jun-2003, 06:35
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road
I tried that into the htaccess but now my site comes up forbidden access?
Am I missing something?
  #4  
Old 21-Jun-2003, 08:56
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road
I have read a few more forums and I seem to think I may have a problem with my .htaccess file being read? But to be honest I havent got a clue and am clutching at straws!
  #5  
Old 21-Jun-2003, 10:33
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
I assure you the rules are working on my set up - I just checked it, so it might be a number of server issues.

You might want to get your web host to confirm that you can use Apache's mod rewrite for your website (if you haven't already confirmed that).
  #6  
Old 21-Jun-2003, 10:38
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road
Thanks for the reply. I am in the process of contacting my host to see why this is not working. One last question, If I put
RewriteEngine on
in the htaccess without any rules would this or should this affect the access to the site? I was trying this as a test.
  #7  
Old 21-Jun-2003, 10:43
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
To be honest I wouldn't know what could happen, since the one question I would ask a host before using them is whether they have it (mod rewrite) on for me.
  #8  
Old 21-Jun-2003, 12:33
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road
One last question this is what is in my htaccess file:

Code:
# -FrontPage- IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* <Limit GET POST> order deny,allow deny from all allow from all </Limit> <Limit PUT DELETE> order deny,allow deny from all </Limit> AuthName http://www.mysite.co.uk AuthUserFile /home/virtual/site/fst/var/www/html/_vti_pvt/service.pwd AuthGroupFile /home/virtual/site/fst/var/www/html/_vti_pvt/service.grp RewriteEngine on RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [L] RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ index.php?opt=$1&id=$2&par=$3 [L] RewriteRule ^([^/]+)/([^/]+)/$ index.php?opt=$1&id=$2 [L] RewriteRule ^([^/]+)/$ index.php?opt=$1 [L]

And then the site shows

Forbidden
you do not have access/ to this site.

Does everything look correct? My host say that the problem is the script and not the server. I have tried everything but the next step is bang my head against a wall to see if that makes a difference.
  #9  
Old 21-Jun-2003, 12:46
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Oh! FrontPage Server Extensions enabled...

How are your links created right now? I told you that my rewrite rule is not perfect yet... so, for now (just to get it to work), it is imperative that the links always end with a slash...

Otherwise point me to a web page with some links so I can figure out if it's just a missing slash or what-not...
  #10  
Old 21-Jun-2003, 13:40
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road
http://www.nwcfa.co.uk is my site
all the links are created from the script/database
I feel happier that I know why things are not working
 
 

Recent GIDBlogToyota - 2008 July Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rewrite urls for Mambo jrobbio MySQL / PHP Forum 16 24-Jul-2003 03:47

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 01:27.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.