Note that there are some explanatory texts on larger screens.

plurals
  1. POReplacing question marks and equal signs with htaccess
    primarykey
    data
    text
    <p>I'm trying to replace question marks and equal signs so that I can use URLs like the following:</p> <p><a href="http://www.mydomain.com/categories/id/23/name/category-name" rel="nofollow">http://www.mydomain.com/categories/id/23/name/category-name</a></p> <p>The above url would be internally redirected to <a href="http://www.mydomain.com/categories?id=23&amp;name=category-name" rel="nofollow">http://www.mydomain.com/categories?id=23&amp;name=category-name</a></p> <p>I am using this .htaccess:</p> <pre><code>Options +FollowSymLinks -MultiViews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php # external redirect from /view.php?id=1 to /view/id/1 RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+([^.]+)\.php\?([^=]+)=([^\s&amp;]+) [NC] RewriteRule ^ /%1/%2/%3? [L,R=301] # internal forward from /view/id/1 to /view.php?id=1 RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ /$1.php?$2=$3 [L,QSA] </code></pre> <p>but it's not working as expected. When I go to <a href="http://www.mydomain.com/categories/id/23/name/category-name" rel="nofollow">http://www.mydomain.com/categories/id/23/name/category-name</a> I get a 500 internal server error. Why? What am I doing wrong?</p> <p><em><strong>updated code</em></strong></p> <pre><code>Options +FollowSymLinks -MultiViews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?(.*)$ $1/$2=$3&amp;$4 [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}/$1.php -f RewriteRule ^([^/]+)/([^/]+)$ $1.php?$2 [L,QSA] </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload