PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have been reading up on mod_rewrite and have tried multiple variations of the rewrite to make my urls appear more seo/user friendly... and it isn't working.
if your going to use that line then dont you have to specify which directory your going to use it for, as the RewriteEngine is on but the 2nd line is saying its relevant to not all directories.
okay. can you let me know if this is possible and if so, how i can fix my rewrite to allow for it.
let's say that a user searches for products then results are displayed as links.
the user is interested in one of the posts and clicks. right now that user clicks the link and is taken to the page with that posts info, in the url, they see: http://www.mysite.com/postspage.php?post_id=543.
how can i make it so that when the user clicks the post they are interested in, they see this in the url: http://www.mysite.com/posts/543
Manually. If you want users to see that url then you'll have to point them to it. Or redirect them...but that'd increase server load and page load times.
okay, so you are saying i'm better off pointing them straight there. i'm new to php for the most part so maybe if i explain a little more about what i have, you can help me see how i can make it better.
my search page shows results and shows them as a link like this:
okay, i'm trying to wrap my head around this, but this is completely different from what i keep reading on every site. can you give me an example if you were going to do it given my scenario?
the link that passes the post_id variable currently looks like:
RewriteEngine On
RewriteRule ^post/([0-9]+)/?$ /postpage.php?post_id=$1 [R=301]
problem is that it redirects from the made up link to the url with everything in it ... my original url. i want the one that it is redirecting from now in this scenario.
Last edited by ninethousandfeet on Fri Aug 14, 2009 4:14 pm, edited 1 time in total.