Search code examples
php.htaccessinternal-server-error

Error in htaccess with RewriteRule


I have this code in my .htacces

RewriteRule ^(.+)/(.+)/(.+)$ index.php?modo=$1&tipo=$2&poblacion=$3

And when I go to myweb.com/first-text/second-text/third-text nad this show me

The following error occurred: The requested URL caused an internal server error.

If you get this message repeatedly please contact the webmaster.


Solution

  • Use the following Rules in .htaccess file:-

    RewriteEngine on
    RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)$ index.php?modo=$1&tipo=$2&poblacion=$3 [L]
    

    Then you can use the url as:-

    myweb.com/modoValue/tipoValue/poblacionValue