Friends,
I’ve list of categories with url look like this ‘index.php?cat_id=1,2,3’
I want to rewrite my url as ‘demo-page.html’
However I want to be use here my page title in url page.
How its possible?

Waiting for reply...

Recommended Answers

All 5 Replies

Hi,

You could always create a 404 error page that does the same job. Just get the script name and do whatever with it. You will need to make sure that the browser doesn't know that its a 404 error.

Hope this help

Kieran :)

Take a look at the mod_rewrite module from the apache webserver, this will do the job for you.

Take a look at the mod_rewrite module from the apache webserver, this will do the job for you.

I have never played around with Apache before but what my idea is better if ahmedeqbal isn't using Apache.

I would be pretty surprised if he is not using apache, php has a tendency to run on it at most webhosting services...
I dont know about your idea, but an error page is an error page, use it properly...
mod_rewrite was made for rewriting urls so..
In case you did not know, you just have to add 3 lines to the .htacces file in your webserver directory and its done, no need to create a custom error page..

you can use mod_rewrite, also if you are generating the pages via a CMS or some backend/admin panel then store the slug(for ex - demo-page) in the DB and then when the user opens the page example.com/demo-page.html query the DB to find the row corresponding to "demo-page" under the slug column and fetch the data. Simple!!! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.