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
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

Link to comment
Share on other sites

[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?

Link to comment
Share on other sites

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.

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.