Stooney Posted November 11, 2008 Share Posted November 11, 2008 I'm not very experience with mod_rewrite. The following bit works fine on my dev server, but when used on my 1and1.com shared host account, I get Error 500 - Internal server error. That problem is with the RewriteRule, as anything that is indeed a file (such as http://site.com/index.php?d=home) works fine. I won't lie, the RewriteRule is basically copy pasted. I will be looking into mod_rewrite a lot more in depth, but for now I'm just looking for a quick fix to get a live site running. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?d=$1 [L,QSA] Quote Link to comment Share on other sites More sharing options...
corbin Posted November 11, 2008 Share Posted November 11, 2008 Is mod_rewrite enabled? Quote Link to comment Share on other sites More sharing options...
Stooney Posted November 16, 2008 Author Share Posted November 16, 2008 Yes it's enabled. After a couple emails back and fourth with 1and1 here's what they said: As we checked your code we found out that the code you used in your .htaccess is incorrect. in response to this: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?d=$1 [L,QSA] Quote Link to comment Share on other sites More sharing options...
corbin Posted November 16, 2008 Share Posted November 16, 2008 Try a super simple rewrite. Something like: RewriteRule somepage\.html someotherpage.html And see if it works. If it does, try adding the rewrite cond with it. If the rewrite cond makes it fail, that's it. If not, it's the RR. Can't just comment out the RR because that would cause an infinite loop. Quote Link to comment Share on other sites More sharing options...
Stooney Posted November 23, 2008 Author Share Posted November 23, 2008 Alright, so I did what you said. I changed my .htaccess (shown below). It works on my dev server, but the live server (hosted by 1and1) gives a page not found error when attempting site.com/somepage.html .htaccess RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule somepage\.html someotherpage.html So I'm guessing that would mean mod_rewrite is actually disabled? They told me it's enabled and I can use it as I wish. Quote Link to comment Share on other sites More sharing options...
corbin Posted November 23, 2008 Share Posted November 23, 2008 That could just mean that someotherpage.html doesn't exist. If mod rewrite weren't enabled, you would be getting a 500 error. Try changing your rewrite to: RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^(.*) /index.php?d=$1 [L,QSA] Quote Link to comment Share on other sites More sharing options...
Stooney Posted November 23, 2008 Author Share Posted November 23, 2008 I made sure someotherpage.html did exist, I made it to test with. The following .htaccess file gives me a 500 error: RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^(.*) index.php?d=$1 [L,QSA] I might just host my own site or get a different host. I don't know what else I can change here, it works fine on my home server just not on live. Quote Link to comment Share on other sites More sharing options...
corbin Posted November 23, 2008 Share Posted November 23, 2008 I can't see why that would be giving a 500 error x.x. Only thing I can think of is change index to /index. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.