V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
GNiux
V2EX  ›  WordPress

设置根域名指向子目录失败,求解(on debian)

  •  
  •   GNiux · 2015-11-30 00:33:20 +08:00 via iPhone · 2102 次点击
    这是一个创建于 3306 天前的主题,其中的信息可能已经有所发展或是发生改变。
    在一个 debian VPS 上建站, LAMP.

    APT 直接下了 WordPress. Debian 说 WordPress 在 debian 上有些区别。也按照 debian 方式部署了,如:

    https://wiki.debian.org/WordPress

    折腾差不多了,就差把根域名指向我的 WP 所在目录了 (debian 默认把它放在 /usr/share/WordPress, 及另一个地方,而非 www/之类)

    然后我就按照 WordPress.org 的攻略操作:

    http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

    其中的:

    Using a pre-existing subdirectory install

    If you already have WordPress installed in its own folder (e.g., http://example.com/wordpress), then the steps are as follows:
    1. Go to the General panel.
    2. In the box for Site address (URL): change the address to the root directory's URL. Example: http://example.com
    3. Click Save Changes. (Do not worry about the error message and do not try to see your blog at this point! You will probably get a message about file not found.)
    4. Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress (wordpress in our example) directory into the root directory of your site — the latter is probably named something like www or public_html. The .htaccess file is invisible, so you may have to set your FTP client to show hidden files. If you are not using pretty permalinks, then you may not have a .htaccess file. If you are running WordPress on a Windows (IIS) server and are using pretty permalinks, you'll have a web.config rather than a .htaccess file in your WordPress directory.
    5. Edit your root directory's index.php. 1. Open your root directory's index.php file in a text editor
    2. Change the line that says:
    require( dirname( __FILE__ ) . '/wp-blog-header.php' );
    to the following, using your directory name for the WordPress core files:
    require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
    3. Save the file.

    6. Login to your site (if you aren't still already). The URL should still be http://example.com/wordpress/wp-admin/
    7. If you have set up Permalinks, go to the Permalinks panel and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. If WordPress can't write to your .htaccess file, it will display the new rewrite rules to you, which you should manually copy into your .htaccess file (in the same directory as the main index.php file.)

    Since the site is not working for some of these steps, it is best to make this change at a time of low activity, e.g., the middle of the night.


    可是,就是……没效呢? 访问根域名是一片空白……

    (不知信息量足够没?……手机打字累了…
    第 1 条附言  ·  2016-01-16 09:56:13 +08:00
    搞掂了搞掂了!!(需求是 URL 转发) ,只要一个 Rewrite(Match) 就行!

    两点有用:
    1 休息几天,放下。差不多忘了之前的配置,再打开。
    2 好好阅读文档,最好打印出来捧在手里。

    WordPress 教的方法,过于复杂,且是复制粘贴,不行的。
    2 条回复    2015-11-30 10:33:08 +08:00
    maskerTUI
        1
    maskerTUI  
       2015-11-30 08:58:12 +08:00 via Android
    装个 lnmp 或者 amp 再加个 WordPress 不是一样的效果吗?比这文档简单多了
    GNiux
        2
    GNiux  
    OP
       2015-11-30 10:33:08 +08:00 via iPhone
    @maskerTUI

    是装了 lamp+ WordPress 呀
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5291 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 07:50 · PVG 15:50 · LAX 23:50 · JFK 02:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.