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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.