Forum Moderators: coopster
I want to create SEO friendly URLs in PHP. I know that we can do from .htaccess file but other than that do we have to make some different php script also?
Following is my files:
index.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<a href="newsdetails.php?nid=1">News 1</a><br>
<a href="newsdetails.php?nid=2">News 2</a>
</body>
</html>
newsdetails.php
<?php
echo "<br> in news";
?>
.htaccess file
# //seo_mod_start
Options +Indexes +FollowSymlinks
RewriteEngine On
# Uncomment the following and add your forum path if rewrites arent working properly
RewriteRule ^index.html$ index.php [L,NE]
RewriteRule ^(.*)-a-([0-9]+).html$ newsdetails.php?nid=$2 [L]
# //seo_mod_end
But when i view index.php in browser its not showing seo friendly urls of news it shud take title of news to display.
Can anybody please help me.
<a href="1.html">News 1</a><br>
<a href="2.html">News 2</a>
You are doing a rewrite not a redirect so going to the original url won't change anything.
Orkut is best social networking site.
Google best search engine
So I need output as below:
orkut-is-best-social-networking-site.php OR .html
google-best-search-engine.php OR .html
htaccess will not take title dynamically ? or I will have to manipulate those names and give urls?