Forum Moderators: phranque

Message Too Old, No Replies

redirect 301

         

kfaer

1:51 pm on May 12, 2012 (gmt 0)

10+ Year Member



hi all,

what .htaccess code to use to redirect any pages with slash to .html ending page

redirect from:

www.example.com/page/

to:

www.example.com/page.html


thank you

[edited by: incrediBILL at 7:18 pm (utc) on May 12, 2012]
[edit reason] fixed URLS, use Example.com [/edit]

g1smd

2:07 pm on May 12, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Use example.com in this forum to prevent auto-linking and keyword obscuration.

There's many previous threads with example code. What have you tried so far. You'll need a RewriteRule.

You should not be redirecting to a URL ending with .html. You should take the opportunity to "go extensionless".

kfaer

2:12 pm on May 12, 2012 (gmt 0)

10+ Year Member



but i've old page already indexed with .html and i do not want to loss it now, i only changed from static html pages to wordpress

kfaer

2:44 pm on May 12, 2012 (gmt 0)

10+ Year Member



sir you reply only once on each post?

incrediBILL

7:20 pm on May 12, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Why would you want to redirect from friendly paths to paths ending in .html?

The current trend it to remove the .html from the path.

What you want is an internal rewrite, not a redirect.

That makes it internally use .html but externally there is no extension visible.

lucy24

11:39 pm on May 12, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



but i've old page already indexed with .html

Then you have to start by redirecting from with-html to without-html. Even if no humans ever use this form, g### will keep crawling it for years to come, so you have to feed them a redirect.