Dreamcube
Dreamcube

Reputation: 165

apache rewrite in .htaccess not working on hosted platform

My problem seems to be directly related to how the apache settings are setup on the hosted platform, it is hosted by crazydomains.com. The problem is my rewrites that work on my dev LAMP are not working on their LAMP. I'm hoping someone with more knowledge than me in rewrites can point out my errors.

The working rewrite on my dev server:

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

The problem rewrite on crazydomains

RewriteEngine On
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^manage/$ /manage/index.php [L,QSA]
RewriteRule ^manage/(.+\..+)$ - [NC,L]
RewriteRule ^manage/(.*)/$ /manage/index.php?page=$1 [L,QSA]
RewriteRule ^(.+\..+)$ - [NC,L]
RewriteRule ^(.+)$ /index.php?page=$1 [QSA]

What I want to happen is anything that starts with http://example.com/manage or http://example.com/manage/ is caught and goes to /manage/index.php and anything else will go the site's root index.php.

I found out that the only rule that matches on this hosting platform is rule for 4 some reason. Of course their support goes as far as linking me to sites to generate a .htaccess file that does not help me as those are simple things and this is a complex rule.

Any help is greatly appreciated!

Upvotes: 1

Views: 138

Answers (1)

anubhava
anubhava

Reputation: 785246

Simplify your rules like this:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^manage/?$ manage/index.php [L,NC]

RewriteRule ^manage/([^.]+)/?$ manage/index.php?page=$1 [L,QSA,NC]

RewriteRule ^([^.]+)/?$ index.php?page=$1 [L,QSA]

Upvotes: 1

Related Questions