简体   繁体   中英

Redirect from old site on Wordpress to Codeigniter. Domain remain same

I'm preparing for migration from WordPress to site written via Codeigniter. I use htaccess very seldom, and never redirection.

My site is working now and clients visit my site. And I cannot just upload new site. So I tried to practise with one page for redirection to another created for testing. I tried with encoded and decoded URL but without success; however, as written in the manual, it should be a simple:

Redirect [status] URL-path URL

.htaccess:

RewriteEngine On

Redirect 301 /?wpsc-product=подвеска-сова-медь-duplicate http://domain.com/?page_id=851

Also, Apache has RedirectMatch and RewriteRule [301] and they are loading server, so I prefer to use simple redirects (I have CPU load limitation on my hosting). I have about 500 links.

Redirect OR RedirectMatch directive from mod_alias cannot match query string. You must use mod_rewrite like this:

RewriteEngine On

RewriteCond %{QUERY_STRING} wpsc-product=подвеска-сова-медь-duplicate [NC]
RewriteRule ^/?$ http://domain.com/?page_id=851 [L,R=301,B]

Make sure to keep this rules on top of your .htaccess .

Reference: Apache mod_rewrite Introduction

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM