Why aren't my Wordpress permalinks working?

I have a Wordpress site in a sub directory:


When I visit http://myip/mysite/ it works with “Plain” permalinks (i.e. http://myip/mysite?page_id=6) and I can navigate the site.

However, when I use “Post name” permalinks (i.e. http://myip/mysite/mypage/), I get a 404. It works fine locally. This is what my .htaccess file looks like:

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

Under Settings > General in Wordpress, I have both the Wordpress Address and Site Address set to:


What am I missing?

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @eightysix

Have you modified Apache virtual file for your domain to Allow URL rewrites? If not, here’s how you go about it:

Open the the Apache virtual file for your domain to make changes:

sudo nano /etc/apache2/sites-available/mysite.conf

Make these additions on the file

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/mysite
    ServerName server_domain_name_or_IP
    <Directory /var/www/mysite>
        AllowOverride All
    . . .

Save and exit then enable mode rewrite which allows you to modify URLs:

sudo a2enmod rewrite

Reload Apache

sudo service apache2 reload

I don’t actually have a virtual host setup, but I believe I have allowed URL rewrites globally in my phpmyadmin file. I followed the instructions here:

sudo nano /etc/apache2/conf-available/phpmyadmin.conf

I added AllowOverride All to <Directory /usr/share/phpmyadmin>.

Then I restarted apache, but that didn’t work…

Do I require a virtual host?