Report this

What is the reason for this report?

Problem with setting Rewrite Directives

Posted on February 28, 2014

Hi,

I seem to be having some trouble with Apache Rewrite Directives.

I put the following directives inside of my /etc/apache2/sites-available/default file:

RewriteEngine on RewriteCond %{request_filename} -f RewriteRule ^(.) $1 [L] RewriteRule ^(([^/])+)(/([^/]{0,32})(/.+)?)?$ index.php?a=$1&q=$3 [L]

When I did that they worked just the way I intended. Except that everytime I navigated to the phpmyadmin url I’d get a 500 error.

So to solve this I added RewriteRule ^(phpmyadmin)($|/) - [L]

However when I did that it seemed to have the effect of completely turning the rewrite engine off.

This is the complete config for the directory

"<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all RewriteEngine on RewriteCond %{request_filename} -f RewriteRule ^(?:phpmyadmin)($|/) - [L] RewriteRule ^(.) $1 [L] RewriteRule ^(([^/])+)(/([^/]{0,32})(/.+)?)?$ index.php?a=$1&q=$3 [L]

</Directory>"

Any help would be appreciated.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Ok I figured it out.
<br> <br>Simply putting the <br>"RewriteRule ^(?:phpmyadmin)($|/) - [L] " <br>last seemed to do the trick.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.