I've created a WordPress version of our site in a subdirectory on our server and wish to re-direct from the root to the subdirectory, like:

mydomain.net to mydomain.net/wordpress

For some reason, when I re-direct the main domain to the subdirectory in cPanel or .htaccess, WordPress does not display the site correctly. All of the CSS I've added in the custom CSS plugin disappears. Plugin is "WP Add Custom CSS".

This only happens when I re-direct from mydomain.net, when I re-direct from mydomain.net/index.php for example, WordPress displays fine.

What could be causing the plugin to fail?

  • Your WordPress install is in the root and not the subfolder. Can you check this? – Alexander Gounder Aug 3 '15 at 18:58
  • I installed it in the sub-directory. – Henry A. Aug 3 '15 at 19:08
  • Then probably your entire domain is getting redirected to subfolder on the same domain causing an infinite loop, is that the error your getting. – Alexander Gounder Aug 3 '15 at 19:11
  • I was getting the error you described at first, but not anymore. Now it just does what I described above. – Henry A. Aug 3 '15 at 19:13
  • Try to set these constants in your wp-config.php file. define( 'WP_HOME', 'sub.example.com' ); define( 'WP_SITEURL', 'sub.example.com' ); define( 'COOKIE_DOMAIN', 'sub.example.com' ); – Emetrop Aug 3 '15 at 19:40

You are redirecting the entire domain hence breaking the site, because whole website is getting redirected to a part causing a broken website.

So instead of using .htaccess just create an index.html file in your root and do a simple Meta Refresh


Use this more detailed explanation to do the same using php

  • You should use WP core function for redirecting rather than PHP functions - wp_redirect or wp_safe_redirect. – Emetrop Aug 3 '15 at 19:47
  • Using WP core function isn't an option if you don't have WP in the root. – Alexander Gounder Aug 4 '15 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.