Permalinks not working after Capistrano deploy

Hi,

Everytime I deploy with Capistrano my permalinks are no longer working. I can set them manually, but that gets old.

I added my .htaccess to linked_files like mentioned in this topic: Permalink and 404 after each deploy. That didn’t seem to do the trick.

I also added made sure there is a .htaccess in the shared/ folder on my server and that there’s a symlink to it from the current/ folder.

Any ideas what could be wrong? Thank you!

Should be all that’s needed. Maybe Apache isn’t following symlinks?

<VirtualHost *:80>
    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>

Check for the FollowSymLinks directory option.

Thanks! Do you know where I can find these settings? I’m on shared hosting at Webfaction. Do I just add the Options FollowSymlinks and AllowOverride None to the .htaccess in the shared/ folder on the server?

In .htaccess it would be Options +FollowSymLinks.

This depends on what your shared host allows you to override in your .htaccess file though. There’s a chance that may not work.

I added Options +FollowSymLinks, but the permalinks are still broken after I deploy.

Just to make sure, this is my shared/.htaccess:

Options +FollowSymLinks

# 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

According to the Webfaction documentation Options +FollowSymLinks is supposed to work. Are there any log files I can check or is there any way I can debug this? Thank you!

Oh, did you set up the linked_files with web/ included?

Like this:

set :linked_files, %w{.env web/.htaccess}

https://github.com/roots/bedrock/blob/master/config/deploy.rb#L18

Yes! Thank you! That seems to do the trick.

Sorry to revive this old thread, but I’m having this problem too.

After deploying, the theme breaks and the permalinks need refreshing. I’ve already added the following to deploy.rb

set :linked_files, fetch(:linked_files, []).push('.env', 'web/.htaccess')
after 'deploy:publishing', 'deploy:update_option_paths'

It doesn’t seem to update the paths correctly.
What am I still missing?

Also, is it normal that the whole /releases/<timestamp>/web/wp/wp-content/themes folder is set in the WordPress options instead of just current/web/wp/wp-content/themes?