Redirect 301 PROBLEM .php to .html

Hi all,

I have problem with redirect 301 and need HELP. :blush:

When I redirect 301 my oldpage.html to my newpage.html works fine, but when I try to redirect 301 /index.php?option=com_wrapper&view=wrapper&Itemid=52&lang=en to newpage.html for example give me a 404 Not Found error :confused:

Here is my htaccess example


<FilesMatch "(?i)^.*\\.(ico|flv|jpg|jpeg|png|gif|js|css)$">
Header set Expires "Sat, 13 Oct 2012 20:00:00 GMT"
</FilesMatch>

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
<Ifmodule mod_rewrite.c>
#Options +FollowSymlinks
RewriteEngine on
RewriteBase /

### re-direct index.html to root / ###
RewriteCond %{THE_REQUEST} ^.*\\/index\\.html\\ HTTP/
RewriteRule ^(.*)index\\.html$ /$1 [R=301,L] 

### re-direct index.htm to root / ###
RewriteCond %{THE_REQUEST} ^.*\\/index\\.htm\\ HTTP/
RewriteRule ^(.*)index\\.htm$ /$1 [R=301,L]

### re-direct non-www to www
RewriteCond %{http_host} !^www.domain.com$ [nc]
RewriteRule ^(.*)$ http://www.domain.com/$1 [r=301,nc,L]
####
</Ifmodule>

Redirect 301 /index.php?option=com_wrapper&view=wrapper&Itemid=52&lang=en http://www.domain.com/EN/newpage.html

Thanks for HELP!
All the best

Sun,

The RewriteRule will ONLY examine the {REQUEST_URI} variable and you’ve attempted to add the {QUERY_STRING} to the regex which is breaking your directive.

Please have a read of the tutorial linked in my signature for more information.

Regards,

DK

First thanks for quick answer David!

I read your tutorial but english like you see is not my first language and I am beginner but I try hard.

This problem I have first time.

I try to use in htaccess just this

Redirect 301 /index.php?option=com_rd_sitemap&view=sitemap&id=1&Itemid=36&lang=ba http://www.my-domain.com/newpage.html

but dont work.

I just want to redirect 301 from old joomla site to my new html site and redirect my old pages 1 by 1 to my new pages.

I try also to test redirect 1page.html to newpage.html and works fine.

What do you advise me?

Thanks for help David.
All The Best

I use this and work! :eek::smiley:

RewriteCond %{QUERY_STRING} ^option=com_contact&view=contact&id=1&Itemid=35&lang=en
RewriteRule ^(index\\.php)?$ http://www.domain.com/newpage.html? [R=301,L] 

Is this right SEO redirect and is it OK?

Sun,

I’m not sure what newpage.html is looking for with that query string but your regex is correct and the trailing ? will delete the query string while the R=301 will tell SEs that the redirection is permanent. I do believe that you’ve got it!

Regards,

DK