I am developing a php web site. Here I want to make the site as clean URL. My index page is domain/news/index.php?i=1. I want to display this URL as clean URL. But I am the beginner of URL rewriting. Does anyone help me??? How to write this URL Thanks in advance
Asked
Active
Viewed 263 times
-3
-
possible duplicate of [How do I do URL rewriting in php?](http://stackoverflow.com/questions/522452/how-do-i-do-url-rewriting-in-php) – Gordon Feb 16 '12 at 11:32
-
1there are thousands of questions like this already arround. please use the search – CyrillC Feb 16 '12 at 11:33
-
..and they're all rubbish. This is not a question. It's a blog post that says "I don't know how to do URL rewriting", but without any attempt at formatting. – Lightness Races in Orbit Feb 16 '12 at 11:44
2 Answers
0
You need to add an .htaccess
file into your root and define the rewriting things there. This is not "in PHP" because PHP doesn't provide a url rewriting method. It's the server (Apache) that read url rewriting files such as .htaccess
.
References

Shoe
- 74,840
- 36
- 166
- 272
0
You can take either of two approaches. The first is to make correct rewrite URL for all links in .htaccess, and the second is to redirect all links with .htaccess to index and "possess on it" with PHP.
Rewriting is easy and there are many relevant docs to be found on the web. Please search first.

Lightness Races in Orbit
- 378,754
- 76
- 643
- 1,055

Hadi Mostafapour
- 1,994
- 2
- 13
- 21