I'm trying to show this url http://www.xyz.com/catnew/newcat.php
as http://www.xyz.com/cat
. Any help is appreciated.
Asked
Active
Viewed 99 times
-3

Oldskool
- 34,211
- 7
- 53
- 66

Kishor Kumar
- 543
- 1
- 12
- 33
-
What exactly is the problem here? – Jan Hančič Feb 20 '12 at 11:14
-
1You need to redirect it, either in your .htaccess file or by using the header() function in index.php - or whatever file handles requests – okyanet Feb 20 '12 at 11:15
-
1With the assumption that you use apache, I would recommend you to look at `mod_rewrite` – Ragnar123 Feb 20 '12 at 11:15
-
@Jan Hančič - I want the first url to be displayed as second. Nothing else. – Kishor Kumar Feb 20 '12 at 11:17
-
1@Kishor Kumar do you mean the completely PHP-unrelated way? `http://www.xyz.com/cat` – Feb 20 '12 at 11:20
2 Answers
2
look up tutorials on mod_rewrite, if your on Apache this may be the answer depending on how you want to do it.

James
- 3,265
- 4
- 22
- 28
1
RewriteEngine On
RewriteRule ^cat/([^/]*)$ /catnew/newcat.php?cat=$1 [L]
The original URL:
http://www.xyz.com/catnew/newcat.php?cat=3
The rewritten URL:
http://www.xyz.com/cat/3

Sandeep Bansal
- 6,280
- 17
- 84
- 126