• Resolved chrisjscott

    (@chrisjscott)


    I realize this sort of issue has been posted countless times but I have yet to find a reply that addresses my issue… long story short: I archived my little WordPress blog just before cancelling my hosting plan and I decided to try my hand at hosting it on my own.

    Got WordPress installed and successfully imported my backup but, while the home page loads, nothing else does – neither posts nor pages.

    After reading a few entries, I found that setting permalink to “Plain” gets things working but none of the other options do. I’ve confirmed that my .htaccess file is updated with mod_rewrite rules whenever I choose a permalink option other than “Plain” (and that those rules are removed when “Plain” is chosen) but that’s as far as I’ve been able to get.

    Any suggestions on where to go from here would be appreciated!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter chrisjscott

    (@chrisjscott)

    One quick follow-up:

    I upped the log level in my Apache error log and found the following being generated when I try to open a page:

    AH00128: File does not exist: /var/www/myDomain/blog/PostName/, referer: https://blog.myDomain/

    This suggest to me that the Rewrite commands being added to .htaccess aren’t working as expected…?

    Hi,

    This sounded like a problem I had last week. Have you enabled the rewrite module of Apache2? On an Debian/Ubuntu system, you can look in the /etc/apache2/mods-enabled/ directory to see if rewrite.load is there.

    If not, this shold enable it:

    sudo a2enmod rewrite

    This will just add a symbolic link from mods-enabled to mods-available.

    Ray

    Thread Starter chrisjscott

    (@chrisjscott)

    Hey, @rwanwork – appreciate the reply and a good suggestion. Unfortunately, it looks like my Module rewrite already enabled

    Thread Starter chrisjscott

    (@chrisjscott)

    I’m wondering if my directives might be messed up…

    My /etc/apache2/sites-available/myDomain.conf contains:

    ServerAdmin webmaster@localhost
    ServerName blog.myDomain
    DocumentRoot /var/www/myDomain/blog
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

    While /etc/apache2/sites-available/myDomain-le-ssl.conf contains:

    ServerAdmin webmaster@localhost
    ServerName blog.myDomain
    DocumentRoot /var/www/myDomain/blog
    ErrorLog /var/log/apache2/error.log
    CustomLog /var/log/apache2/access.log "combined"
    
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/myDomain/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/myDomain/privkey.pem
    LogLevel crit

    I tried adding RewriteEngine on to the latter config file; made no difference…

    • This reply was modified 1 year, 10 months ago by chrisjscott.

    Hi @chrisjscott,

    Is that your entire conf file? I think you need to add something in order for Apache to make use of the .htaccess files.

    I’m not sure if you’re using Ubuntu, but I have it bookmarked so it is handy for me. i.e., https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-22-04-with-a-lamp-stack

    I think you need:

    <Directory /var/www/wordpress/>
      AllowOverride All
    </Directory>

    I think I have followed these instructions before to set up my system. If you are using Ubuntu, perhaps you can go through it as sort of a checklist.

    I can’t see anything obviously wrong with your conf files. However, personally, I don’t have any RewriteEngine or RewriteRule in my conf file. It’s all in my .htaccess file (that’s written by WordPress when I choose permalinks; I didn’t edit it).

    Hope this helps!

    Ray

    Thread Starter chrisjscott

    (@chrisjscott)

    @rwanwork

    I’ll be darned that was it! Specifically, this needed to be placed within the virtualhost config for blog.myDomain contained within the myDomain-le-ssl.conf file (I’m using Let’s Encrypt for SSL).

    THANK YOU!!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘unable to set permalink post-site migration’ is closed to new replies.