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…?
Ray
(@rwanwork)
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
Hey, @rwanwork – appreciate the reply and a good suggestion. Unfortunately, it looks like my Module rewrite already enabled
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 3 years, 4 months ago by
chrisjscott.
Ray
(@rwanwork)
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
@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!!!