How to hide .php file extension without using .htaccess?

Go To StackoverFlow.com

0

I have a problem trying to hide .php extension from the url

I have been asked to hide it and because they are on a shared host i don't think i have access to .htacess so is there another way to hide it through a php function that i would call everytime an anchor is being selected?

2012-04-05 18:49
by Mohamed Hassan
You are not sure you can use a htaccess? Why don't you try - romainberger 2012-04-05 18:50


0

.htaccess is what you would have access to on a shared server, as opposed to httpd.conf, which you wouldn't.

Put a .htaccess file in your document root with the following

FAIL

If your site stops loading, then you can use .htaccess :)

Of course, ^ that is a joke.

2012-04-05 18:50
by sberry
Was it a joke? I actually employ this technique from time to time to check if AllowOverride is All, although I generally write more obscure stuff : - Berry Langerak 2012-04-06 12:52


1

Is this truly about hiding .php or is it more about having cleaner URLs?

If you truly can't access .htaccess (i.e. your host has this turned off via AllowOverride None) and assuming you also can't have your Apache conf settings updated for your VHost, the best you can do may be

http://example.com/page.php/my/clean/url

By default, Apache will send this URL to page.php even with everything else after it. This is the most common way of creating "cleaner" URLs without access to mod_rewrite.

2012-04-05 18:56
by nategood
Ads