Jump to content

How to make this modification?


Recommended Posts

I have an Ubuntu server running apache2 with PHP 5.2.6.

 

I have a few scripts that parse $_SERVER['PATH_INFO'] so I can link to files like this: /index.php/query

 

What I want to do is simply like to: /query

The server would parse that as /index.php/query since index.php is default.

 

I've done this before on another server, but don't know how it was configured....

Link to comment
https://forums.phpfreaks.com/topic/162503-how-to-make-this-modification/
Share on other sites

if you're using Apache you can use mod_rewrite to direct all requests to index.php

 

Add the following to a file called .htaccess and place it in the directory where your index.php is located to.

rewriteEngine On

rewriteRule (.*) index.php/$1

 

When going yoursite.com/whatever it will actually call index.php/whatever

[Wed Jun 17 23:47:51 2009] [alert] [client 192.168.2.100] /home/admin/website.inet/.htaccess: Invalid command 'rewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

 

Is this normal?

 

 

 

I realize this is turning into an Apache discussion, not php configuration- should this topic be moved?

Looks like you need to enable the mod_rewrite module within Apaches configuration. Open Apaches httpd.conf and find then following line

#LoadModule rewrite_module modules/mod_rewrite.so

 

Remove the # from the start of the line. Save the httpd.conf and restart Apache.

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.