hello my friends :)
I'm new to web dev so ive started learning PHP.
i have a couple of questions...

1. Can i change the default .php extension to .whatever ?
2. Can i change something.html to something.whaever extension? in Apache Mod rewrite? i mean SEO. i want to make fake extension that can show like this:

index.jsp
whatever.jsp etc...
i know im using PHP but would it be possible change to .jsp extension? ive installed XAMPP on my local PC and I edited Apache.conf file and added index.jsp next to the AppDirectory. so shouldn't it allow .jsp extension?

if so please explain it in detail as much as you can.
anyhelp would be much
appreciated

Recommended Answers

All 4 Replies

I believe Apache will let you map any extension you wish to a given mime type, but off the top of my head I can't recall which file it is in. Check the docs on mapping mime types.

There are two ways to do this:

1) Tell Apache to parse all .phpfiles a .xxxfile. Using this method you do not have to change any files extensions or worry about any redirects. To do this, place this code in your httpd.conf file:

AddType application/x-httpd-php .php .xxx

2) Use a 301 redirect to redirect from the .php files to the .xxx files. You can do that by placing this code in the root directory of your website:

RedirectMatch 301 ^/(.*)\.php$ http://www.yourdomain.com/$1.xxx

tnx a lot.

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.