i'm trying rewrite
http://www.example.com/fr/index.html
to hide in url folder fr
http://www.example.com/index.html
the htaccess file in folder fr
this .htaccess file :
options -indexes rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename}\.html -f rewriterule ^([^/]+)/$ $1.html rewritecond %{the_request} ^[a-z]+\ /([^/]+/)*[^.]+\.html(\?[^\ ]*)?\ http/ rewriterule ^(([^/]+/)*[^.]+)\.html$ http://%{http_host}/fr/$1 [r=301,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !(\.[a-za-z0-9]{1,5}|/)$ rewriterule (.*)$ http://%{http_host}/fr/$1/ [r=301,l]
any appreciated. !
here new .htaccess but... nothing
rewritecond %{the_request} \ /fr/ rewriterule ^fr/(.*)$ /$1 [l,r=301] rewritecond %{request_filename} !-d rewritecond %{request_filename}\.html -f rewriterule ^([^/]+)/$ $2.html rewritecond %{the_request} ^[a-z]+\ /([^/]+/)*[^.]+\.html(\?[^\ ]*)?\ http/ rewriterule ^(([^/]+/)*[^.]+)\.html$ http://%{http_host}/$1/$2 [r=301,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !(\.[a-za-z0-9]{1,5}|/)$ rewriterule (.*)$ http://%{http_host}/$1/$2/ [r=301,l]
here solution. hope can :
options +followsymlinks rewriteengine on rewritebase / # hide folder fr rewritecond %{request_filename}.html -f rewritecond %{request_uri} !/$ rewriterule (.*) $1\.html [l] rewritecond %{the_request} ^[a-z]{3,}\s/+fr/([^\s]+) [nc] rewriterule ^ %1 [r=301,l] rewritecond %{request_filename} !-f rewriterule (?!^fr/)^(.*)/$ /fr/$1 [l,nc] # end rewritecond %{the_request} ^[a-z]+\ /([^/]+/)*[^.]+\.html(\?[^\ ]*)?\ http/ rewriterule ^(([^/]+/)*[^.]+)\.html$ http://%{http_host}/fr/$1 [r=301,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !(\.[a-za-z0-9]{1,5}|/)$ rewriterule (.*)$ http://%{http_host}/fr/$1/ [r=301,l]
Comments
Post a Comment