• Resolved meekrob

    (@meekrob)


    I know, this sounds like a newb error. But the codex instructions are simple and I executed them successfully just 6 months ago on a client site. But this week I have tried it in two different locations with failure: a new site, and on a localhost installation. Both are running Apache. My local install is on OS X 10.11.6.

    Here are the steps:
    1) In Dashboard->Settings, change the WordPress Address (URL) to root, i.e. https://sitename.com/wp –> https://sitename.com
    2) Do the same under Site Address (URL).
    3) Submit. Ignore error message.
    4) Copy index.php and .htaccess to root directory. Change index.php to refer to the subdirectory containing the installation.
    require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );

    The site now loads some front page content, but on a white page with no styling. It looks like it is half-transferred. The browser status bar is quite active, sending multiple requests, but nothing visibly changes. This is explained by access-log, showing multiple 404s for things that should be working now, starting with:
    POST /wp-cron.php?doing_wp_cron=1473357879.5045380592346191406250 HTTP/1.1" 404 18444

    Some other key 404s include (but are by no means limited to):

    GET /wp-content/themes/mythemename/css/mythemename.css?ver=1.0.0 HTTP/1.1" 404 19965
    GET /wp-includes/js/jquery/jquery.js?ver=1.12.4 HTTP/1.1" 404 19950

    Now, I thought the culprit might be the url redirection, so I turned on trace6 for mod_rewrite in the virtual host configuration in the localhost site. The redirection appears to be successful. For example:

    [Thu Sep 08 12:04:39.524223 2016] [rewrite:trace3] [pid 7032] mod_rewrite.c(476): [client 127.0.0.1:52145] 127.0.0.1 - - [prfol.localhost/sid#7f883c020c40
    ][rid#7f883c042780/initial/redir#1] [perdir /Users/david/Sites/prfol/public_html/] strip per-dir prefix: /Users/david/Sites/prfol/public_html/index.php ->
     index.php, referer: https://prfol.localhost/wp-cron.php?doing_wp_cron=1473357879.5045380592346191406250
    [Thu Sep 08 12:04:39.524236 2016] [rewrite:trace3] [pid 7032] mod_rewrite.c(476): [client 127.0.0.1:52145] 127.0.0.1 - - [prfol.localhost/sid#7f883c020c40
    ][rid#7f883c042780/initial/redir#1] [perdir /Users/david/Sites/prfol/public_html/] applying pattern '^index\\.php$' to uri 'index.php', referer: https://pr
    fol.localhost/wp-cron.php?doing_wp_cron=1473357879.5045380592346191406250
    [Thu Sep 08 12:04:39.524249 2016] [rewrite:trace1] [pid 7032] mod_rewrite.c(476): [client 127.0.0.1:52145] 127.0.0.1 - - [prfol.localhost/sid#7f883c020c40
    ][rid#7f883c042780/initial/redir#1] [perdir /Users/david/Sites/prfol/public_html/] pass through /Users/david/Sites/prfol/public_html/index.php, referer: h
    ttp://prfol.localhost/wp-cron.php?doing_wp_cron=1473357879.5045380592346191406250

    However, I still get the 404 for the top line of this request.
    I’ve tried hard refreshes. Clearing the cache. Even using a new browser that has never visited the site.

    My .htaccess:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    My httpd-vhosts.conf for this site:

    <VirtualHost *:80>
        ServerAdmin [my email]
        DocumentRoot "/Users/david/Sites/prfol/public_html"
        ServerName prfol.localhost
        ServerAlias www.prfol.localhost
        ErrorLog "/private/var/log/apache2/prfol-error_log"
        CustomLog "/private/var/log/apache2/prfol-access_log" common
        LogLevel debug rewrite:trace6
    </VirtualHost>
    <Directory "/Users/david/Sites/prfol/public_html">
        Options FollowSymLinks Multiviews
        MultiviewsMatch Any
        AllowOverride All
        Require all granted
    </Directory>

    After writing this, I realize that WordPress apparently requests its normal URLs, apache applies the redirect rules on them, but then something doesn’t complete.

    I’m still convinced that it’s something I have overlooked or skipped. I’m able to revert to the subdirectory by restoring the WordPress Address and Site Address values via phpmyadmin, and deleting the root-level index.php and .htaccess.

    Can anyone see what I’m missing? Or else help me find how the redirect is not executed? Perhaps by setting trace on another module?

    Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • My first thought would be to check your DB. Have you updated the sites urls correctly?

    BTW, I must say that your post is impressive. Very thorough!

    Hi, Do you have mod_rewrite compiled in your apache? Have you tried changing the permalinks to default?

    @meekrob, if WordPress itself is still located in the wp subdirectory (as it seems to be according your step #4, quoted below with emphasis), then the WordPress Address (URL) should continue to point to that folder, e.g.,https://sitename.com/wp.

    In other words, only the Site Address (URL) would need to be changed in that case, whereas you’ve changed them both instead.

    4) Copy index.php and .htaccess to root directory. Change index.php to refer to the subdirectory containing the installation.

    • This reply was modified 8 years, 2 months ago by girlieworks.
    Thread Starter meekrob

    (@meekrob)

    Yes @girlieworks, that was the problem!! Thank you. It would have taken me forever to see this.

    Thread Starter meekrob

    (@meekrob)

    Thank you, @danhgilmore I tried to include everything I had learned about the problem… Looking too deep, I’m afraid.

    @meekrob, I’m glad I was able to help. ??

    I’m having same problem, with no apache overlay. I changed only the site address, so that’s not my issue. I have an old site in the root. I changed it’s index to index.old, so it doesn’t open, but perhaps still creating a conflict? Nothing opens now, and I can’t get into wp-admin to change settings back, so I can’t even continue work on the wp install.

    Oh please help. So many, many, many months of work on this new site. You’d think I’d have learned enough to get this to work. Sigh.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Moving WordPress directory (to root) per codex instructions causes multiple 404s’ is closed to new replies.