Please help me if any one know about url rewrite in PHP. i need this url http://www.website.com/abc.php?vid=55 TO this url http://www.website.com/vid/title-of-the-page (here i need slug value title of the page) Please help me how to create this type of url on my php web site. i need url rewrite like wordpress. Please give me way how i implement. Regards, Ronny
yes i have used htaccess but how i implement http://www.website.com/abc.php?vid=55 TO this url website.com/vid/title-of-the-page (here i need slug value title of the page) Thanks for reply
Please help me when i open this url http://www.website.com/abc.php?vid=55 after that automatic goes to new rewrite url with slug Thanks in advance
Paste this in file .htaccess: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php [L] </IfModule> # END WordPress
Thanks for reply but this is wordpress htaccess file i need htaccess for own php website i need this url http://www.website.com/abc.php?vid=55 TO this url http://www.website.com/vid/title-of-the-page (here i need slug value title of the page)
10 seconds in Google... http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html http://www.generateit.net/mod-rewrite/
basically you need to do two things : 1. .htaccess to decode the url and send it to abc.php 2. you need to change the file that create the url. if the page that refer to abc.php?vid=55 is index.php, you need to change your code in index.php example : old program $query = "SELECT id,title FROM vid_table"; $result = mysql_query($query); while ($data = mysql_fetch_array($result)) { echo '<a href="abc.php?vid=' . $data['id'] . '">' . $data['title'] . '</a>'; } new program while ($data = mysql_fetch_array($result)) { echo '<a href="abc.php/vid/' . str_replace(" ", "-", $data['title']) . ">' . $data['title'] . '</a>'; } in abc.php you need to change the way the program read to database if (isset($_SERVER['REDIRECT_URL'])) /* this is means that the page get redirected from .htaccess */ { $parts = explode('/', $_SERVER['REDIRECT_URL']); array_shift($parts); $url_name = $parts[1]; $url_name = str_replace("-", " ", $url_name); $query = "SELECT id FROM vid_table WHERE title = '$url_name'"; $result = mysql_query($query); $data = mysql_fetch_array($result); $_GET['id'] = $data['id']; } then you can continue with your program i hope it's not too confusing