Jump to content

mod_rewrite, using php to figure out what url has bee typed in and if theres ..


Recommended Posts

Hey,

 

My main problem is...

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

 

That is my .htaccess

 

now i think i may have read most tutorials found on Google over the last 2-3 weeks. Nothing as helped because everything on there helps with static url's like changing index.php?id=2 to /2.html and stuff.

 

http://jonathanleighton.com/blog/keeping-track-of-uris That was the closest i ever got, i get lost at

It’s then simply a matter of checking if $request exists in the database, and redirecting if it isn’t the default one. You can edit your URIs as much as you like : )

Because i don't understand what is being checked. I realize this is more mod_rewrite focused but no one replies to posts in the forum (on this domain). If finding out how to do this properly costs me, let me know.

After reading that article all urls are stored in the database for a particular item, I believe there is a new and an old uri stored.

 

$request holds the current uri. You then use $request in a query to see if the requested uri is an old style uri. If it is an old style uri it'll redirect the user to the new uri for that particular item.

rep-rangers isn't a field.

/rep-rangers/
/rep-rangers/events.php
/rep-rangers/contest.php
/rep-rangers/team.php
/events/
/forms/index.php
/forms/contact.php
/tyke-league/
/tyke-league/team.php
/tyke-league/events.php
/tyke-league/calendar.php

 

The above is how my directory is setup. They are physical files and folders. What i was shooting for was to allow someone to type in the above links and show the information found on /index.php?id=### Rather then have all those physical files in place. That is where i'm getting lost. Because all the tuts online only show ways of allowing /rep-rangers/ to show the pages info but not /tyke-league/

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.