Home › Forums › BulletProof Security Free › Giving WordPress Its Own Directory – Website root .htaccess file
Tagged: Giving WordPress Its Own Directory, GWIOD
- This topic has 6 replies, 3 voices, and was last updated 8 years, 2 months ago by
AITpro Admin.
-
AuthorPosts
-
Rick
MemberHello, my WP install resides in the /wordpress directory, although the site url does not show the “/wordpress” level (I used the guidelines at WP codex to do this). The .htaccess file inside the wp folder has been modified by bulletproof, but the root level .htaccess is intact.
In the root there’s the index.php file that redirects to the wordpress/wp-blog-header.php. What can I do to protect the root level? Is bulletproof aware of this configuration?
Thanks.AITpro Admin
KeymasterIt sounds like you are using the “Giving WordPress Its Own Directory” WordPress installation method correct? – http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
You would need to manually copy the .htaccess file that BPS creates in your /wordpress folder to your website root folder and change the RewriteBase and RewriteRule as shown below.
RewriteBase /wordpress/ to RewriteBase / RewriteRule . /wordpress/index.php [L] to RewriteRule . /index.php [L]
Rick
MemberYes, that was the guide. Thanks a lot!
jenni101
ParticipantHi again,
A follow-on Q really, regarding the redirection structure. This is for redirecting my old (root install) site original blog posts to an exact copy of these posts on the new (subdirectory install) site – so same url/slug EXCEPT that I want to put my new site in it’s own folder (GWIOD) for ease of management long term.
So for example old blog post’s url =
www.mysite.com/blog/info.php
and same blog on new site’s url = www/mysite.com/newsite/blog/info.phpSo what I’m getting really confused about is how you write the redirect rules from old to new in both the new site .htaccess (www/mysite/newsite) and the root .htaccess (www/mysite), as from what I’ve read about GWIOD you copy the new site’s .htaccess and index.php into the root (which WAS where my old site was installed). BUT in the WP Settings of the new site you set both the actual and the desired url (ie. my original url) so the GWIOD works…. So does that mean it will all just send everything round and round in an endless redirect loop?
The more I try to work it out the more tangled I seem to get, as I’ve only ever done root installed WP sites, or addon domains etc, not the GWIOD – so any clarification would be very helpful!
many thanks, J
AITpro Admin
KeymasterI think this code is what you are looking for:
RedirectMatch 301 ^/(.*)$ http://www.mysite.com/newsite/blog/$1
jenni101
ParticipantYes, thanks that would fix it! So my whole old site is redirected to my whole new site (with identical pages in + new ones too) – and then I could add in any redirects for old pages I’m not going to use in my new site (but are now copied into my new site) to other relevant/updated versions in my new site – and put this individual redirect code in my new site .htaccess file?
So for eg. if a page in my old site was this: www/mysite.com/page-one it would have first been redirected to my new site to here: www/mysite.com/newsite/page-one and then I’d redirect this outdated page to it’s shiny new version www/mysite.com/newsite/page-two in my new site .htaccess.
Is that the best way for individual outdated files?
AITpro Admin
KeymasterYou can individually redirect old urls or you can do a complete site redirect of all old urls. Totally up to you.
-
AuthorPosts
- You must be logged in to reply to this topic.