iarp Posted May 20, 2008 Share Posted May 20, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/106493-mod_rewrite-using-php-to-figure-out-what-url-has-bee-typed-in-and-if-theres/ Share on other sites More sharing options...
wildteen88 Posted May 20, 2008 Share Posted May 20, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/106493-mod_rewrite-using-php-to-figure-out-what-url-has-bee-typed-in-and-if-theres/#findComment-545878 Share on other sites More sharing options...
iarp Posted May 20, 2008 Author Share Posted May 20, 2008 Now that you've said that, it sounds more like this wouldn't get the information from index.php?id=123 and display the url as /rep-rangers/ Quote Link to comment https://forums.phpfreaks.com/topic/106493-mod_rewrite-using-php-to-figure-out-what-url-has-bee-typed-in-and-if-theres/#findComment-545891 Share on other sites More sharing options...
wildteen88 Posted May 20, 2008 Share Posted May 20, 2008 You'll have to modify your code so it returns whatever content is based on the field rep-rangers is stored in rather than the id. Quote Link to comment https://forums.phpfreaks.com/topic/106493-mod_rewrite-using-php-to-figure-out-what-url-has-bee-typed-in-and-if-theres/#findComment-545896 Share on other sites More sharing options...
iarp Posted May 20, 2008 Author Share Posted May 20, 2008 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/ Quote Link to comment https://forums.phpfreaks.com/topic/106493-mod_rewrite-using-php-to-figure-out-what-url-has-bee-typed-in-and-if-theres/#findComment-545910 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.