By eightysix
I have a Wordpress site in a sub directory:
/var/www/mysite/
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]
</IfModule>
# END WordPress
Under Settings > General in Wordpress, I have both the Wordpress Address and Site Address set to:
http://myip/mysite
What am I missing?
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!
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
</Directory>
. . .
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?
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.