Jump to content

Archived

This topic is now archived and is closed to further replies.

rossh

hiding .php extension

Recommended Posts

Hi i don't have access to modify any apache settings on the server.  I want to hide the .php extension and i'm  trying out renaming the file without an extension and then including ForceType application/x-httpd-php in .htaccess Is this the best method and what are the down sides before i get stuck into my whole site!  Is there alternative if this is not a prefered option?

Thanks

R

Share this post


Link to post
Share on other sites
Looks like this method does not work in firefox should that be right?

Thanks

R

Share this post


Link to post
Share on other sites
You would want mod rewrite. here is a nice tutorial http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html

Share this post


Link to post
Share on other sites
Hi thanks i've tried using mod_rewrite already and i'm getting an 500 internal server error?  my site is in a subdirectory does this make a difference?  I've looked on php.ini and it look like it there?

Thanks

R

Share this post


Link to post
Share on other sites
It shouldn't make a difference. I have never had that issue before... Can you please post a copy of the .htaccess that you tried with. You may have made an error when writting it.

Share this post


Link to post
Share on other sites
Hi, i was trying this example
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [nc]

which i don't think is really what i want but i get the 500 error right away no pages from the subdirectory will load.

Thanks

Ross

Share this post


Link to post
Share on other sites
Put this in your .htaccess file: [code]AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html[/code]

Share this post


Link to post
Share on other sites
Here is a very detailed mod rewrite reference.. http://forums.devshed.com/apache-development-15/mod-rewrite-guide-common-requests-267522.html

replace the * with a +

like this

RewriteRule ^(.+)\.html$ $1.php

Share this post


Link to post
Share on other sites
Hi thanks for getting back to me.  I've tried both:-

Options +FollowSymlinks
RewriteEngine on
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html

and

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.+)\.html$ $1.php

and both give me a 500 error?

Thanks again

R

Share this post


Link to post
Share on other sites
Look in your servers error log. The error log will give you a reason why you are getting the 500 Internal Error message.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.