Rewrite Problen .htaccess Redirect 301

I need put a redirect on a site and a have some problems.

I have this original .htccess

RewriteEngine on
RewriteCond %{REQUEST_URI} .json$ [NC]
RewriteRule .* - [F,L]
RewriteRule config/.* - [F,L]
RewriteRule config - [F,L]

RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
RewriteCond %{REQUEST_FILENAME} -d [NC]
RewriteRule ^.+$ - [L]

RewriteCond %{QUERY_STRING} ^$ [NC]
RewriteRule ^([^?]+)$ /novo-site/index.php?url
RewriteCond %{QUERY_STRING} ^$ [NC]
RewriteRule ^$ /novo-site/index.php

AddHandler php54-script .php
suPHP_ConfigPath /home/personalglass1/site02/novo-site/

And i put the last 4 lines to provide the redirect for this 5 pages.

The result is this:

RewriteEngine on

RewriteCond %{REQUEST_URI} .json$ [NC]
RewriteRule .* - [F,L]
RewriteRule config/.* - [F,L]
RewriteRule config - [F,L]

RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
RewriteCond %{REQUEST_FILENAME} -d [NC]
RewriteRule ^.+$ - [L]

RewriteCond %{QUERY_STRING} ^$ [NC]
RewriteRule ^([^?]+)$ /novo-site/index.php?url=$1
RewriteCond %{QUERY_STRING} ^$ [NC]
RewriteRule ^$ /novo-site/

AddHandler php54-script .php
suPHP_ConfigPath /home/personalglass1/site02/novo-site/

Redirect 301 /sobre-a-personal-evolution /sobre/
Redirect 301 /fechamento-de-sacadas-e-varandas /produto/envidracamento/
Redirect 301 /revendedores-autorizados /revendedores/
Redirect 301 /entre-em-contato /contato/
Redirect 301 /fotos-de-sacadas-evolution /galerias/

But when i requested the page:
http://example.com/sobre-a-personal-evolution

I received this:
http://example.com/sobre/?url=sobre-a-personal-evolution

But the correct for me would this one:
http:// example.com/sobre/

Is the last one that i need when a request the first.

I tried to some changes but nothing works!

Someone could help me solve this and explain how to this, i need understand how to do this.

Thanks!


Source: .htaccess

1 Comment

  1. Digin Dominic

    From the mod_alias/Redirect documentation:

    Additional path information beyond the matched URL-Path will be appended to the target URL.

    “Additional path information” is somewhat vague, but I assume they are referring to the urlparameter.

    Now, this should not affect functionality at all, so again I assume that you just don’t like how the URL looks.

    However, since you are using mod_rewrite anyway, you can achieve the same effect as Redirect with RewriteRule:

    RewriteRule ^/sobre-a-personal-evolution(?:/(.*))?$ /sobre/$1 [R=301,L]

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.