0
votes

Basically I have this lines into my .htaccess of my personal computer using xamp

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

Whats append? Im moving to my dedicated server using apache2 on Debian 8.4 And the server gave me the next Error. Why thats append?

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

2
500 errors cover basically everything, so it's difficult to help. You should check the error log as directed by the error message. It might located at /var/logs/apache2/error.log. Update us with that error if it doesn't give you enough clues to solve the problem.HPierce

2 Answers

0
votes

Sounds like mod_rewrite is not enabled in Apache. To enable it:

a2enmod rewrite
service apache2 restart
0
votes

Such a mistake may happen because of lack of <ifModule mod_rewrite.c> construction, because this module might not be installed. So, you can add this condition, but mind that it won't solve your problem - you need the module installed to have redirects.

Update:

So, for now you'd better change code to:

<ifModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^([^/]+)/$ $1.php
  RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
  RewriteRule (.*)$ /$1/ [R=301,L]
</IfModule>

Read more on Apache Docs

Then you need to switch the mod_rewrite module, you can read example here: How to install the Apache mod_rewrite module It's more of the system administrating sphere rather than of programming.