-2

I have already searched a lot, found a lot of articles, but nothing works. I have create a test website and a test directory in it.

http://myexp.net63.net/apartment/index.php?id=999

I want this URL to shorten like the below.

http://myexp.net63.net/apartment/999

How can I do this using htaccess or any other way?

Muhammad Sohail
  • 181
  • 2
  • 2
  • 6

2 Answers2

2

Please show any effort in researching . This POST has been question and is duplicated several times here

SIMILAR POSTS

Remove index.php From URL - Codeigniter 2

Remove index.php from url by htaccess

CodeIgniter | .htaccess removing index.php from url

htaccess remove index.php from url

remove index.php url rewriting .htaccess

Community
  • 1
  • 1
Jhonathan H.
  • 2,674
  • 1
  • 16
  • 26
  • these links were helpful and helped me to get the work done. But not I want to reduce my URL further. I have shorten http://myexp.net63.net/page.php?id=6 to http://myexp.net63.net/page/6 but now I want to reduce http://myexp.net63.net/page/6 to http://myexp.net63.net/6 How can I do this? – Muhammad Sohail Feb 26 '14 at 12:38
0
RewriteEngine On
RewriteRule ^apartment/([^/]*)$ /apartment/index.php?id=$1 [L]

Use this code in your .htaccess file

Ankit Pise
  • 1,072
  • 9
  • 27
  • it didn't work. After adding these lines, when I visit the URL http://myexp.net63.net/apartment/999 it redirects me to the hosting server website. – Muhammad Sohail Feb 25 '14 at 03:25