-1

I want to use htaccess to make an URL such as www.domain.com/profile.php?id=1 to www.domain.com/1/ and www.domain.com/1/contact or www.domain.com/1/gallery.

Would you like to help me?

  • 2
    what have you done so far ? –  Dec 18 '18 at 18:29
  • @dean I searched on Google I got www.domain.com/profile.php?id=1 to www.domain.com/1/ I have files profile.php, contact.php & gallery.php. but I don't know how to rewrite URLs like www.domain.com/1/contact – Arnab Dasgupta ADG Dec 18 '18 at 18:32
  • You might want to take a look at this thread: https://stackoverflow.com/questions/25080835/pretty-urls-with-htaccess. – 0x7a6d Dec 18 '18 at 18:52

1 Answers1

0

This is the basic rule to hide index.php from the URL. Put this in your root .htaccess file.

mod_rewrite must be enabled with PHP and this will work for the PHP version higher than 5.2.6.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

i get it from here htaccess remove index.php from url