1

My local version of my website(MAMP) seems to be getting different results for mod_rewrite than my Ubuntu servers.

For example, when I type in

http://gymtracker.in/articles

It should be internally converting to

http://gymtracker.in/articles.php

for the server, but it's just throwing a 404 error.

I've confirmed that my .htaccess file is being read at it throws an error when garbage is placed.

Here is the output of the rewrite log

`110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/articles.php -> articles.php
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (3) [perdir /var/www/] applying pattern '^article/([a-zA-Z0-9-]*)' to uri 'articles.php'
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/articles.php -> articles.php
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (3) [perdir /var/www/] applying pattern '(.*)' to uri 'articles.php'
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (4) [perdir /var/www/] RewriteCond: input='/var/www/articles.php' pattern='!-d' => matched
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (4) [perdir /var/www/] RewriteCond: input='/var/www/articles.php' pattern='!-f' => not-matched
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (1) [perdir /var/www/] pass through /var/www/articles.php
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/favicon.ico -> favicon.ico
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (3) [perdir /var/www/] applying pattern '^article/([a-zA-Z0-9-]*)' to uri 'favicon.ico'
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/favicon.ico -> favicon.ico
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (3) [perdir /var/www/] applying pattern '(.*)' to uri 'favicon.ico'
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (4) [perdir /var/www/] RewriteCond: input='/var/www/favicon.ico' pattern='!-d' => matched
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (4) [perdir /var/www/] RewriteCond: input='/var/www/favicon.ico' pattern='!-f' => not-matched
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (1) [perdir /var/www/] pass through /var/www/favicon.ico

Here is also the output of my .htacess file

Options +FollowSymLinks

RewriteEngine on

RewriteRule ^article/([a-zA-Z0-9-]*) /article.php?title=$1

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]

I'm just unsure as to why it's working on my local web server but not my remote one(ubuntu) when the configurations appear to be the same.

Compulsed
  • 33
  • 3

1 Answers1

0

Assuming you have your .htaccess at web root / try with

Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /

RewriteRule ^article/([a-zA-Z0-9-]*) /article.php?title=$1 [NC,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ $1.php [L]
Ravi K Thapliyal
  • 51,095
  • 9
  • 76
  • 89