2

I'm using Wordpress. How can I do this redirect with .htaccess file?

e.g. from domain.com/blog/hello-world/ to domain.com/hello-world/

Thanks.

Edit: hello-world is not a folder. It is a page.

Amit Verma
  • 40,709
  • 21
  • 93
  • 115
Mert
  • 151
  • 2
  • 9
  • possible duplicate of [Url rewriting not working with wordpress unless using \[R\]](http://stackoverflow.com/questions/25362629/url-rewriting-not-working-with-wordpress-unless-using-r) – Sumurai8 Apr 17 '15 at 22:03
  • No, my question is different. hello-world is not a folder. It is a page. – Mert Apr 17 '15 at 22:13
  • Your Wordpress blog was located under `/blog/` and now you want it to be located under `/`. Read my answer on that question and click the link to the Wordpress guide. It will tell you how to do that. – Sumurai8 Apr 17 '15 at 22:19
  • Ok. I will try it. Thanks. http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory – Mert Apr 17 '15 at 22:40

1 Answers1

2

You can use Redirect Directive

Try this in your Root/.htaccess

Redirect 301 /blog/hello_world/ /hello_world/
Amit Verma
  • 40,709
  • 21
  • 93
  • 115
  • I tried it. Redirect 301 /blog/merhaba-dunya/ /merhaba-dunya/ Redirect is successful but blog page does not open. http://laysos.com/blog/ click to "Merhaba dünya!" blog post. You can see. – Mert Apr 19 '15 at 10:35
  • Hi @Starkeen. But does not open blog post. You can try it. Enter this address ( http://laysos.com/blog/ ) and click the "Merhaba dünya!" post. "Merhaba dünya!" does not open. – Mert Apr 19 '15 at 10:55