PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Sep 22, 2019 5:56 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: hide id with mod_rewrite
PostPosted: Wed Nov 02, 2011 7:29 am 
Offline
Forum Commoner

Joined: Sat Nov 10, 2007 9:03 am
Posts: 25
Hi.

I have a link like this:
index.php?page=article-title&id=12

article-title and id are dynamical

How can I show in my address bar only: http://www.website.com/article-title/
not http://www.website.com/article-title/12/

What I must change in htaccess for this.

Thanks


Top
 Profile  
 
PostPosted: Wed Nov 02, 2011 7:33 am 
Offline
Forum Regular
User avatar

Joined: Sun Dec 29, 2002 6:40 pm
Posts: 908
Location: VA
I'm not an expert in mod_rewrite but I don't think you can. How else would you know which article to load unless you're storing it in a session? Also, if someone was to share the link with a friend how would the page know which ID to pull?


Top
 Profile  
 
PostPosted: Wed Nov 02, 2011 10:17 am 
Offline
Forum Regular
User avatar

Joined: Wed Mar 05, 2008 11:23 pm
Posts: 732
Location: Sunriver, OR


Top
 Profile  
 
PostPosted: Thu Nov 03, 2011 3:28 am 
Offline
Forum Commoner

Joined: Sat Nov 10, 2007 9:03 am
Posts: 25
If I fetch in databases using 'article-title' instead the id it will take longer to search for it ?
I know that if you search by id is much faster than text.


Top
 Profile  
 
PostPosted: Fri Nov 04, 2011 2:28 am 
Offline
Forum Regular
User avatar

Joined: Wed Mar 05, 2008 11:23 pm
Posts: 732
Location: Sunriver, OR


Top
 Profile  
 
PostPosted: Fri Nov 04, 2011 10:49 am 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6446
Location: 53.01N x 112.48W
Why do you want to hide the ID? What do you gain?

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group