Hello, I have a site where in the url's are in this format http://www.domain.com/category.php?id=30987 i want to change it to http://www.domain.com/page-title.php Can someone please help me out on this as like what code i need to attach to get the title to be parsed and displayed in the url after the domain name and title words be separated by " - " symbols. Do i have to make some mods in the .htacesses file too ? Thanks for your help.
You will have to change your category.php file, so that it gets the category based on a unique name, instead of an ID. I can't help you with that without seeing your code. As for the htaccess file, it'd be something like this: RewriteEngine On RewriteRule ^(.*)\.php$ category.php?title=$1 Code (markup):
Thanks Nico, Actually this is the exact req - Instead of : http://muzica dot x6 dot ro/melodia dot php?id=3442 (please replace the dot word with " . " ) The url should be: http://muzica dot x6 dot ro/strength-of-a-woman-3442.html Here are the two main files catagoria.php and melodia.php,please check the attachment. Thanks for your time,i really appreciate your help.
If you just want to turn http://muzica dot x6 dot ro/melodia dot php?id=3442 into http://muzica dot x6 dot ro/strength-of-a-woman-3442.html You basically want to drop out all the spaces and non-alphanumeric characters from the title and put - in place of the spaces (search engines read that as a space), and then -<id of content>.html, and then add a rewrite rule like: RewriteRule ^(.*)-([0-9]+).html$ category.php?id=$2 That reads <anything>-<##>.html, and passes the ## as the variable $_GET['id'] to category.php, so it keeps everything you currently have, and you just replace your links and add that line in your htaccess and you're set.
here is the .htaccess file that i have made after your suggestion RewriteEngine On RewriteRule ^(.*)-([0-9]+).html$ category.php?id=$2 php_flag register_globals on <Files 403.shtml> order allow,deny allow from all </Files> is this okay.....or i need to attach some other code somewhere because it doesn't seem to be working.
For the record (don't remove it because apparently your code needs it), but register_globals on is a bad idea, it's disabled by default in php for a reason. But anyway, what you have is right. It's not going to automatically change your links, but doing blah-blah-friggity-blah-30987.html should display category.php?id=30987
Thanks for the help,But somehow its not working Is there any way in which i can get the title shown in the url....i have the end user as well in my mind not just for the search engines sake.
You change your urls that are being displayed to include the title-id.html, it's really a simple concept.
Thanks projectshifter but i am really a dumbass when it comes to php.Can you tell me how do i implement it.