Question

Problem with setting Rewrite Directives

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.


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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