Jump to content

A php page now needs explicit .php to be shown


Recommended Posts

Hope this is the right forum for my question.

 

I have a php page, say named myInstance.com/excellent.php. The page used to work when user type the following to the browser address bar:

myInstance.com/excellent (i.e., no dot php)

Recently the server is somehow modified by someone, and now I need type

myInstance.com/excellent.php (i.e., with dot php)

in order to access the page.

 

Not sure if it has anything to do with apache server.

 

Anybody know what was changed and how I can get the address without dot php working again (because many people bookmarked the page with the address without dot php)?

Thanks a lot!

-tx

Probably MultiViews. In your .htaccess,

Options +MultiViews
It allows you to omit extensions from files that Apache recognizes.

 

where this .htaccess file should be? should I create a file and add Options +MultiViews to it and put the file in the excellent.php directory? thanks.

Probably MultiViews. In your .htaccess,

Options +MultiViews
It allows you to omit extensions from files that Apache recognizes.

 

That is a cool trick!  Is that how many of the big sites do it when they say go to www.example.com/contact or something like that?

where this .htaccess file should be? should I create a file and add Options +MultiViews to it and put the file in the excellent.php directory? thanks.

Probably in the root of your website, but at the least in the same directory as the script. (Which are apparently the same.)

 

That is a cool trick!  Is that how many of the big sites do it when they say go to www.example.com/contact or something like that?

Generally not: bigger sites tend to use more sophisticated setups than letting Apache execute individual PHP scripts directly. Like they'll have something configured that says the "/contact" URL executes through a certain OOP class - not actually a particular .php file. Think of it as URL rewriting done with PHP code instead of with mod_rewrite.

Archived

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

×
×
  • Create New...

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.