RewriteRule ^order/([^/]*)(/?)+$ index.php?do=order&name=$1 [L] 

Everything works as it should for me, only site.ru/order (without a slash at the end) returns error 404. How can I fix it?

    1 answer 1

    For CEO it is better that each content acc. just one url. We will consider the "correct" URL with a slash at the end. Instead of site.ru enter your website address.

     # Вар. 1 - должно начинаться с order и заканчиваться слешем RewriteCond %{REQUEST_URI} ^order/(.+)/$ RewriteRule ^order/(.+)/$ index.php?do=order&name=$1 [L] # Вар. 2 - пришли без слеша в конце - редиректить на "правильный" RewriteCond %{REQUEST_URI} ^order RewriteCond %{REQUEST_URI} !/$ RewriteRule ^(.*)$ http://site.ru/$1/ [L,R=301] 
    • does not work - inferusvv
    • I tried it like this: RewriteRule ^ order (/?) + $ index.php? do = order [L] RewriteRule ^ order /(.*)(/?)+$ index.php? do = order & name = $ 1 [L] But this link does not work here: site.ru/order/name/ (with a slash on the end) - inferusvv
    • found a working variant: RewriteRule ^ order (/?) + $ index.php? do = order [L] RewriteRule ^ order / ([^ /] *) (/?) + $ index.php? do = order & name = $ 1 [ L] - inferusvv
    • Updated the answer. It is necessary to allow only one URL per page, so if you come with the "wrong" one - without a slash at the end, then you need to do 301 redirect to the correct one, with a slash. - Sergiks