I have developed a script and its using some id for each post or user, eg : site.com/?id=12 etc But for SEO and other options I just want to change those ID to keyword or text. So what should I do ? Can anyone please help ?
Instead of querying the database by the id, use the post title.. You could look in to mod_rewrite with .htaccess if you want to make your URL's SEO friendly
Redirect all requests to index.php, then analyse the request url and see which page is requested. You'll need a routing file to keep track of which page applies to which id, then simply show that ID as normal. Dan.
You can add this in your .htaccess file: RewriteEngine On RewriteCond $1 !^(index\.php|assets|sitemap\.xml|robots\.txt) RewriteRule ^(.+)$ index.php?$1 [L] Code (markup): It will pass query string to index.php (unless it's calling assets folder or sitemap.xml/robots.txt). Then you can use domain.com/var1/var2/ and if you add echo $_SERVER['QUERY_STRING']; PHP: in your index.php it will output "var1/var2"
Imagine a MySQL database, with post_id column. You would need to adapt the script so post_id now becomes internet-marketing etc. Then instead of querying MySQL (through PHP) with the post_id of a number, you do it with the text. Further details: Google 'Keyword Slugs'.
My problem is here. I know how to make clean url using rewrite engine for //www.sitename.com/index.php?ca...cat=Serverside but if my current site url is generated like this: user.php?id.250 and news.php?id.450 or download.php?id.450 I want to make clean url from content (title in the content) from user.php?id.250 and news.php?id.450 .com/download.php?id.450.54, will be .com/download/games/nfs-2/ note that "nfs-2" and "games" did not come from url and it came from the page content.. What I want to do can be called same like this forum thread as id to keyword.. Can you please refer us to article or project ?
Wordpress does it in one of its plugins. Look at the source or Google "use of slug mod rewrite"... Sorry I can't give cut and paste code, but it depends on how your site is setup...