Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

PHP open file without .php extension

My friend has a project that he wanted me to work on while he is on vacation.
He sent me his code, I connected the database and set up the site.

On some pages, particular modules don't open for me.

example code:
PHP Code

<?php 
$url 
= base_url+'includes/actions/autocomplete?module=measurements 

To make it work, I need to add the .php extension like so:
PHP Code

<?php 
$url 
= base_url+'includes/actions/autocomplete.php?module=measurements 

Why does it work for him without the extension and not for me?
Does it have to do with the apache settings?
[Image: nExO5H4.png]
Maybe he got this on his .htaccess
Code
IndexIgnore * # prevent directory listing

Order deny,allow
Allow from *

# ------------------------------------------
# Rewrite so that php extentions are not shown
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

I get those code from: stackoverflow.com/a/32140158
You might also want to read this topic about url rewritting: stackoverflow.com/questions/16388959/url-rewriting-with-php
Without looking into the code its hard to answer. As @Backbone said, your friend may be using .htaccess
You may need to give rewrite permissions to the public directory for the virtual host and then enable mod_rewrite and check for a valid .htaccess file. If all these things are there you should be able to do what you want with a URL.
@Backbone

This worked for me! Thank you. I tried looking on google but I guess I didn't know how to word my question.

@Yani

To be honest, I'm not sure when I got this code from, I think I just made it up real quick.
[Image: nExO5H4.png]
No problem.
I'll be more active here so if you have any question, just post it here.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[PHP] by MXD-TakeshiJan 18, 2019 11:17 AM 3 299 Jan 18, 2019 11:17 AM
Last Post: phlex
[PHP] by 3yZtwglFSCUsJun 26, 2016 12:55 AM 2 233 Jun 26, 2016 12:55 AM
Last Post: 3yZtwglFSCUs
[PHP] by ExodiJan 6, 2016 08:24 AM 2 194 Jan 6, 2016 08:24 AM
Last Post: stackoverflowin