regex - .htaccesss RewriteRule won't work -
i want rewrite
htttp://www.site.ru/company.html?name=bestcompany
to
htttp://www.site.ru/company/bestcompany.html
please suggest wrong. do:
rewriterule ^company/([^/]*)\.html$ /company.html?name=$1 [l]
cms modx, .htacces in root folder, full .htaccess code:
rewriteengine on rewritebase / rewritecond %{http_host} . rewritecond %{http_host} !^www\.site\.ru [nc] rewriterule (.*) http://www.site.ru/$1 [r=301,l] # friendly urls part rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?q=$1 [l,qsa] rewriterule ^company/([^/]*)\.html$ /company?name=$1 [l]
rearrange rules this:
rewriteengine on rewritebase / rewritecond %{http_host} . rewritecond %{http_host} !^www\.site\.ru [nc] rewriterule (.*) http://www.site.ru/$1 [r=301,l,ne] rewritecond %{the_request} \s/+(company)(?:\.html)?\?name=([^\s&]+) [nc] rewriterule ^ /%1/%2.html? [r=302,l,ne] rewriterule ^company/([^./]+)\.html$ /company?name=$1 [l,nc,qsa] # friendly urls part rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?q=$1 [l,qsa]
Comments
Post a Comment