Recommended Answers

So you are correct, you need to write some URL Rewrite rules in your .htaccess file. It would be very helpful if you yourself familiarized with regex otherwise, you are going to go nuts trying to copy someone else's rules. Rules are pretty custom to what you need.

Here is …

Jump to Post

All 4 Replies

So you are correct, you need to write some URL Rewrite rules in your .htaccess file. It would be very helpful if you yourself familiarized with regex otherwise, you are going to go nuts trying to copy someone else's rules. Rules are pretty custom to what you need.

Here is another DaniWeb recent thread on a very similar topic.

http://www.daniweb.com/web-development/php/threads/463463/another-.htaccess-question-sorry

Member Avatar

But not clear idea on this, it will great if someone show me the correct and clear way to do this.

@vishalonne

From this:

http://cbse.in/classxii/question_papers.php

to this:

http://cbse.in/classxii/question_papers

you just want to remove the php extension?

On your htaccess code you need to add this line:

RewriteEngine On
RewriteRule ^question_papers$ /question_papers.php [L]

That will remove the php extension.

Does that make sense?

You can use .htaccess for URL rewrite, but it's more used in this case: domain.com/index.php?page=home ==> domain.com/home
If you have created your pages without taking in consideration that you will be using URL rewrite, then you have to go with what 'LastMitch' suggested. Good Luck

Be a part of the DaniWeb community

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