admin管理员组文章数量:1410689
I currently have a website at site and have WordPress installed in me website's root folder. My website includes pages like:
- site
- site/page
- site/2015/10/01/post....
- site/login
- site/wp-content/uploads/...
I would like to move all WordPress files into one subdirectory for sanity and NOT CHANGE ANY publicly facing URLs. Other posts here and and the official support thread talk about "Giving WordPress its own directory" but require changing URLs:
- (site will load the homepage, but all other publicly facing URLs change)
- Move wordpress to folder without changing urls (similar question but talks about install multiple blogs)
Please advise if this is possible.
I currently have a website at site and have WordPress installed in me website's root folder. My website includes pages like:
- site
- site/page
- site/2015/10/01/post....
- site/login
- site/wp-content/uploads/...
I would like to move all WordPress files into one subdirectory for sanity and NOT CHANGE ANY publicly facing URLs. Other posts here and and the official support thread talk about "Giving WordPress its own directory" but require changing URLs:
- https://codex.wordpress/Giving_WordPress_Its_Own_Directory (site will load the homepage, but all other publicly facing URLs change)
- Move wordpress to folder without changing urls (similar question but talks about install multiple blogs)
Please advise if this is possible.
Share Improve this question asked Sep 1, 2015 at 18:09 William EntrikenWilliam Entriken 2552 gold badges3 silver badges9 bronze badges3 Answers
Reset to default 6The procedure is thoroughly documented in Codex under Moving a Root install to its own directory.
You misunderstand the point about changing URLs in it, and yes the terminology sucks. The only URLs that will change are those that are based on the "WP address". That would be WordPress core, essentially the admin area.
All content URLs are based on "Site address", following this procedure, that will still be the root of your site.
Since you want to retain uploads in place, you can do that by keeping wp-content
in the root (splitting it out of core folder) and adjusting configuration for that. See Moving wp-content folder.
Okay, here is how it is done:
- Move
wp-*
,index.php
,.htaccess
to your newwordpress
folder Edit
wordpress/.htaccess
:- Find this line:
RewriteRule . /index.php [L]
- Make it:
RewriteRule . /wordpress/index.php [L]
- Find this line:
Create a new file in
/path/to/www
called.htaccess
then add this:
RewriteEngine on RewriteRule ^$ https://www.example/ [L] <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^/wordpress/index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /wordpress/$1 [L] </IfModule>
Method for moving Wordpress files to another folder (directory) without changing the Wordpress configuration, i.e., completely transparent to Wordpress:
- create a directory where the Wordpress installation will be moved into, e.g. "sitedir"
- move the WP installation, including
.htaccess
, into that newly created directory - edit the
.htaccess
file in the www root directory (likely public_html) and insert the following stances:
RewriteEngine On RewriteBase / # redirect to ./sitedir/ RewriteCond %{http_host} ^example\$ RewriteCond %{request_uri} !^/sitedir(/.*)$ RewriteRule ^(.*)$ /sitedir/$1 [L,QSA] # extra, redirect www.example to example RewriteCond %{http_host} ^www\.example\ [NC] RewriteRule ^(.*) http://example/$1 [R=301,L]
Replace "example" with your domain and "sitedir" with the name of the folder that WP would be placed in.
本文标签: permalinksMove Wordpress to subdirectorykeep ALL URLs
版权声明:本文标题:permalinks - Move Wordpress to subdirectory, keep ALL URLs 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744804750a2626076.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论