mod_rewrite troubles

The rewrite goes like this:

  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]

mod_rewrite is working fine and it's enabled, but the page content isn't being displayed properly.

I have another VPS that I decided to upload these files to and test, and when I goto something like example.com/real/page (on the other VPS, different host), it returns correctly on my other VPS with the same code and rewrite. But when I do that on my linode, it just keeps giving me the content from index.php and not the /real/page.

Any ideas what settings I should be looking for that might cause that? The other VPS is a managed one, so I don't really know everything it has.

If you need additional information let me know.

3 Replies

If it's an old app then it might require register globals to be enabled in php. Try enabling that in your php.ini and see if that helps.

http://php.net/manual/en/security.globals.php

@Nibbler:

If it's an old app then it might require register globals to be enabled in php. Try enabling that in your php.ini and see if that helps.

http://php.net/manual/en/security.globals.php

Nope, didn't fix it :/

Incase this helps anyone:

The server it works on is running: Apache v2.2.17 on CentOS, PHP v5.2.16

My linode is running on: Apache v2.2.14 on Ubuntu 10.04, PHP v5.3.2

Hi, I'm sorry I can't offer any advice on this one as I have a similar issue with mod_rewrite.

I have Ubuntu 11.04 installation with PHP MyAdmin (working fine) and Apache2. No mail or any extras. The static site comes up, but when I put up a cakephp site, I get a 404 "The requested URL was not found on this server." mod_rewrite is enabled, apache was restarted. The .htaccess files are all there, confirmed and correct. The site works locally, it works on cheapo shared host, but somewhere in the apache2 installation is the magic key that I can't find.

I'd appreciate any help. Hope the original poster finds a solution as well.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct