1

how do i change permalink of my url

http://www.example.com/index.php?id=230

to

http://www.example.com/index/230

Raghs
  • 23
  • 1
  • 4

2 Answers2

3

See e.g. ".htaccess fix for a pretty permalink in PHP?". Also, you should be able to find loads of tutorials for mod_rewrite (and related questions).

Try out:

RewriteRule ^index/([0-9]+)$ index.php?id=$1 [QSA,L]
Community
  • 1
  • 1
jensgram
  • 31,109
  • 6
  • 81
  • 98
  • @Raghs OK, did you turn `RewriteModule On`? If yes, `mod_rewrite` is probably not enabled. Try a [`phpinfo()`](http://php.net/manual/en/function.phpinfo.php) to verify. It is [possible](http://textpattern.com/weblog/135/partly-messy-clean-urls-without-modrewrite-experimental) without `mod_rewrite`, too (but is harder to get right). – jensgram Apr 01 '11 at 08:49
  • @jensgram i need to update permalinks http://www.example.info/index.php?wiki=india i want to change it to http://www.example.com/wiki/india I have this sample code in my htaccess but its not working RewriteEngine on RewriteBase / RewriteRule ^index/([0-9a-z]+)$ index.php?wiki=$1 [QSA,L] – Raghs Apr 01 '11 at 08:57
  • @Raghs Just to make sure that we're talking about the same: You have changed the rendering of your permalinks from `index.php?wiki=india` to `index/india`, right? And now you need the server to convert *incoming requests* for e.g. `index/india` to `index.php?wiki=india`? – jensgram Apr 01 '11 at 09:01
  • @jensgram ya ryt. i need help about tat. Thanks for ur help! – Raghs Apr 01 '11 at 09:05
  • @Raghs OK, then I guess we'll need you to post the full `.htaccess` file. Also, try and make a `phpinfo.php` with ` – jensgram Apr 01 '11 at 09:08
  • @jensgram i am new to htaccess, i have **RewriteEngine on RewriteBase / RewriteRule ^index/([0-9a-z]+)$ index.php?wiki=$1 [QSA,L]** in my htacess. – Raghs Apr 01 '11 at 09:16
  • Well, that ought to work. Now try with the phpinfo file and the rewrite rule I posted above instead. It will tell whether *anything* works. – jensgram Apr 01 '11 at 09:20
  • @jensgram it dint work in godaddy hosting there is no way to access phpinfo(),but permalink works for wordpress blog hosted wit godaddy – Raghs Apr 01 '11 at 09:29
  • @Raghs Hmm, I've found a few resources you may find helpful: [Godaddy Hosting mod_rewrite with .htaccess Files](http://surf11.com/entry/153/godaddy-hosting-mod-rewrite-with-htacces) and [Find the Current PHP Version and Settings in Linux Shared or Dedicated Server Account](http://help.godaddy.com/article/5073?locale=en). – jensgram Apr 01 '11 at 10:03
0

You can use generateit to create rewrite rule for apache and if you use nginx then use gdix to convert apache .htaccess rule.

Web Dev
  • 11
  • 1