url rewrite/custom 404

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
neilmills34
Forum Newbie
Posts: 1
Joined: Fri Feb 09, 2007 12:57 pm

url rewrite/custom 404

Post by neilmills34 »

Hello,
I have a problem which I hope someone can cast some light on for me.

I have built a site and CMS which loads a page by template/page content pulled from the database.

So for example:
index.php would load the homepage
index.php?u=2 would load the about us page
index.php?u=3 would load what we do page and so on....

Hence all pages are delivered from one index page.

The CMS actually creates HTML links such as aboutus.html?u=2 and solution.html?u=8

What I want to achieve for SEO purposes, is for this 'dummy' URL to be written in browser address bar, but the actual page being linked to is - index.php?u=2

I have got my ISP to create a custom php 404 page.

Can this URL rewrite be achieved with PHP or do I have to use apache mod_rewrite????

Do hope you can help.

Cheers,

Neil.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

If you are talking about the browser address bar, you need mod_rewrite as the URL sent to the server would have to be a clean one. That means the ugly URLs left in the page controller output you are talking about will resolve, but will result in ugly URLs in the address on the next click.

Why can't you just make all the URL's pretty and use mod_rewrite to handle all page requests?
Post Reply