3

So I've been tinkering. Apache's .htaccess was redirecting my WWW client just fine (if there is no WWW present, 301 to the same URL with a WWW included), and it was redirecting things with file extensions (i.e. index.html will redirect to index.php). It's only URLs that are without an extension. It refuses to decipher them.

My current file:

RewriteEngine On
RewriteBase /

# Clean URL
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/?$ $1.php [NS,L,R=permanent]

# Force WWW
RewriteCond %{HTTP_HOST} !^www\.thevgc\.net$
RewriteRule ^(.*)/?$ http://www.thevgc.net/$1 [NS,L,R=permanent]

I've been trying to figure this out all night long now. mod_rewrite is enabled, and I had to create a symbolic link to /etc/apache2/mods-enabled/rewrite.conf before actually making the file, which consists of the following:

RewriteEngine On

Thoughts on this dilemma of mine?

Cora
  • 269
  • 3
  • 17
  • Is your .htaccess enabled? Try putting some garbage text at the top and see if it generates 500 error in your browser or not. – anubhava Nov 25 '12 at 04:18
  • I scribbled in `HAHAHAH THIS SHOULD TOTALLY BREAK EVERYTHING` which didn't break anything. – Cora Nov 25 '12 at 04:19
  • Well that means your setup doesn't have .htaccess enabled. Please enable .htaccess in your `httpd.conf`. – anubhava Nov 25 '12 at 04:28
  • I'm running Ubuntu 12.10. From what I've been made to understand, I don't have one, and instead have `apache2.conf`. Or if I do, I certainly have no idea where to find it. – Cora Nov 25 '12 at 04:29
  • I don't have Ubuntu at present but look in `/etc/httpd/conf.d/` directory. – anubhava Nov 25 '12 at 04:32
  • That's a no-go. `ls /etc` returned `hosts.deny`, `hp`, `ifpludg`. There's no `httpd` folder. – Cora Nov 25 '12 at 04:34
  • But my Apache error log is showing that HAHAHAHA is an invalid command. – Cora Nov 25 '12 at 04:35
  • Scratch that stuff above. Looks like I had a `$_GET` floating around in my URL that was preventing the HAHAHAHA stuff from activating somehow. Removed the WWW URL redirect code and the $b=8 from my URL, returned a 500 error. Removed the HAHAHAHA, is now working. Still 404s when trying to get a non-directory, non-file page. – Cora Nov 25 '12 at 04:38
  • The error log has now spit out `[Sat Nov 24 20:38:09 2012] [error] [client 10.0.0.4] Negotiation: discovered file(s) matching request: /var/www/www/game (None could be negotiated)., referer: http://10.0.0.3/` – Cora Nov 25 '12 at 04:39

1 Answers1

2

SO! I found the answer to my problem. Looks like if you run the command a2dismod negotiation it magically starts working, or at least, it did in my case. Problem solved, case closed, thread done. The mystery has been solved.

Cora
  • 269
  • 3
  • 17