Web Hosting Talk







View Full Version : htaccess rewrites not... well... rewriting.


Strike1011
07-20-2007, 01:00 AM
I have an htaccess file in the root folder linked to a subdomain which is supposed to redirect all requests (with the exception of a few folders and an error document I set up while trying to fix this problem) to another page that handles all the requests on that subdomain.

Here is the contents of the file:

ErrorDocument 404 /404.php
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/images
RewriteCond %{REQUEST_URI} !^/skins
RewriteCond %{REQUEST_URI} !^/404.php
RewriteRule ^/(.*) /wiki/index.php/$1

(Yes, I know I am doing exactly what mediawiki says "You should never do")

The problem is my rewrites aren't... rewriting. I navigate to the subdomain with a browser and i get a directory listing. I click on the /wiki folder and I get redirected to /Main_Page which is what /wiki/index.php is supposed to do, but the htaccess rewrites should have rewritten the request as /wiki/index.php/Main_Page, but it didn't. Instead I was brought to my own 404 error page (as set in my htaccess file.)

Obviously, the htaccess file itself is working, but the rewrites are not. I know this is probably a problem that was caused by something I overlooked, but any suggestions?

Engelmacher
07-20-2007, 02:49 PM
Is mod_rewrite installed and enabled and do you have permission to use it in an .htaccess file?

Strike1011
07-21-2007, 04:03 PM
yes. In fact, im using a very similar rewrite on another part of my site for my wordpress script.

bilalk
07-21-2007, 07:18 PM
Maybe give this a shot:


RewriteEngine On

RewriteCond %{REQUEST_URI} !^/images
RewriteCond %{REQUEST_URI} !^/skins
RewriteCond %{REQUEST_URI} !^/404.php
RewriteRule ^(.*)$ /wiki/index.php/$1

Strike1011
07-21-2007, 08:45 PM
Its worth a shot...

Besides, either way, it should redirect to index.php which would give me the error page that my php file generates rather than a 404 if i had the wrong request.

P.S: I've submitted a support ticket at my hosting service, and they dont seem to know what im talking about... They keep telling me to talk to the writer of the script im using even after i've told them at least 3 times that I am the one who wrote the htaccess file, and that the problem is with the htaccess file, not with the script its being used for