Link to home
Start Free TrialLog in
Avatar of Insoftservice inso
Insoftservice insoFlag for India

asked on

wordpress redirection issue

i have wordpress with domain name blog.test.com which i want to redirect to www.test.com/blog.
I know it can be done via htaccess but issue is that wordpress is on cdn as it gets lots of hit and www.test.com is on normal server which can't bear such load.
What steps has to be taken and on which level if given step by step it would be great.

Server : Linux
Framework for test.com is laravel
Avatar of Kimputer
Kimputer

You said www.test.com can't bear the load, yet you want to use it (since www.test.com/blog is on that server)? Can you explain why you want that?
Or did you mean, it needs to redirect to blog.test.com (which could be possibly on another server)?
Avatar of Insoftservice inso

ASKER

Reason "Boss is always right" lol :)

We would keep images of wordpress on CDN and rest code on www.test.com server. So that load of the server is balanced to certain extent.
Redirection part has been implemented , but after redirection laravel is creating issue as it is considering it as controller and not as folder.
Please guide if you have any knowledge about it
<VirtualHost *:80>
   DocumentRoot "/var/www/test_blog"
   ServerName blog.treo.biz
   Redirect 301 / http://treo.biz/blog/
</VirtualHost>

will it be implemented to all links of wordpress

As below code is not working as expected

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^blog.treo.biz$ [OR]
RewriteRule (.*)$ http://treo.biz/blog/$1 [R=301,L]
</IfModule>
It works for few links but fail for other links. just confused why its happening if you have any idea please share
Please give examples of working and non-working links. What does it show in the address bar, and what's the result of the webpage showing?
But its not redirecting even i kept redirection rule in apache  .
blog.ridlr.in had to be redirected to ridlr.in/blog it works for few links but fail for other
for eg:
http://blog.ridlr.in/category/delhi/
I have not seen a successful redirect ever. Can you give me the links?
We are just confused for it as it works for few minutes and later fails
same has been added to newshub.ridlr.in   with only domain change in the rule
Check the correct rewrite logging function (depends on which apache version you're running) and turn it on, highest log level possible.

For apache 2.4 it's here:

http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#logging
If possible please provide me the code if possible

<VirtualHost *:80>
   DocumentRoot "/var/www/test_blog"
   ServerName blog.treo.biz
   Redirect 301 / http://treo.biz/blog/
</VirtualHost>
I'm not super hot on rewrite rules, but one thing you could try out to improve performance is to install a plugin to Wordpress which provides caching. I see there are 2 very popular ones (1 million+ installs) in the "Popular" section of the Wordpress Plugin page, being "WP Super Cache" and "W3 Total Cache".

I'm also aware that Wordfence (a popular security plugin) has a caching feature built in (you do need to activate it, as it's not on by default).
@Terry do you mean to say i have add wp super cache plugin for redirection ?
 or something  else just confused
No, I'm not suggesting help with redirection. I'm suggesting a Wordpress caching plugin may help with reducing the load. Sorry that wasn't clear.

Another thought: Do you have a security plugin in the Wordpress installation? If not, it may be malicious traffic causing most of the load. With quite a number of sites I've started managing recently, that was an issue. In that case, installing and configuring the Wordfence plugin to add a firewall to the site may solve the problem altogether.
@terry My issue is of redirection from one site to other and not security.
Please help me in redirection
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.