I feel like I have read every blog or post on this topic but there are so many out there... I still seem to be missing SOMETHING.I don't know what. My site is hosted on Amazon EC2.
My mod rewrite module is definitely working. I used to have the following in my .htaccess to no avail:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Then, I did "chmod -v 666 .htaccess" to make sure Wordpress could accesss it.
My /etc/apache2/sites-available/default looks like this
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
# AllowOverride FileInfo
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
# AllowOverride FileInfo
Order allow,deny
allow from all
</Directory>
And my /etc/apache2/sites-enabled/000-default looks like this, due to the advice of another thread
<Directory />
Options FollowSymLinks
# AllowOverride FileInfo
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
# AllowOverride FileInfo
Order allow,deny
allow from all
</Directory>
When I restarted Apache, all the text listed above in my .htaccess disappeared and pretty permalinks still do not work. Any one know what I should do next????
In your Apache conf, you need to enable the .htaccess files:
AllowOverride All
Probably you did, but didn't mention so I ask to make sure.. Did you set your desired permalink structure in wp admin? Settings -> Permalinks? I suggest to try Custom structure like /%category%/%postname%/ or /%postname%/
Related
I have local server, on which I'm running WordPress with Composer.
After database migration from my local to AWS RDS, the permalinks changed it's behaviour: now there's 'index.php' in the beginning of tags, like:
http://example.com/index.php/name-of-page
Also, in the wp-admin->Settings->Permalinks the structure is custom now:
/index.php/%year%/%monthnum%/%day%/%postname%/
Details about my local server:
Xubuntu 18
Apache2
AllowOverride All for both / and var/www/
it's on Composer, with custom dir (wp-content is seperated from wp core)
.htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /project/public/wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /project/public/wp/index.php [L]
</IfModule>
# END WordPress
What I have tried:
http://dejanjanosevic.info/remove-index-php-permalink-in-wordpress/
http://derekmolloy.ie/remove-index-php-from-your-wordpress-url/
updating permalinks
updating composer
selling my soul to Satan
What are the results?
Modyfying .htaccess has no effect - just ends in 404, the only links that work are still the ones that include /index.php/. Updating permalinks from WordPress has same result.
I'm running out of ideas here.
I've got it.
For anyone looking for a solution to the same problem, here's guide:
Change permalink settings in wp-admin to pretty permalinks
Install mod_rewrite module in apache
The most important part, in etc/apache/apache2.conf (NOTE THAT YOU MUST CHANGE THE NAME OF FOLDER):
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
#<Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>
<Directory "/var/www/html/NAME_OF_YOUR_PROJECT_FOLDER">
Options FollowSymLinks
AllowOverride All
</Directory>*
Restart apache
I can't for the life of me figure out getting Wordpress to work with pretty permalinks on my Apache server. I've searched online and tried a myriad of combinations of things. The URL in question is www.trixiebangbang.com. I have a traditional LAMP stack running on Ubuntu all hosted with AWS.
I want the Wordpress "Day and Name" permalinks working. I have already selected that in Wordpress and updated my .htaccess file and given it 755 permissions:
# .htaccess file
# 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
That still results in a 404 error when I view my blog posts. For example if I go to this example blog post it doesn't work. I then updated my /etc/apache2/sites-enabled/000-default.conf configuration file to be the following:
# 000-default.conf file
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
<Directory />
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
I am very careful and sure to execute "sudo service apache2 restart" after every change I make before testing. Can someone please tell me what's wrong here? Thanks in advance.
After more searching I was able to piece together a solution that worked for me. I updated the 000-default.conf file to the following and restarted the server. I hope this helps someone else.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName trixiebangbang.com
DocumentRoot /var/www/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
I can't seem to figure this out. I'm using Apache 2.4.7 on Ubuntu 14.04 and I have mod_headers enabled. In my /etc/apache2/apache2.conf file, I have the following default Directory statements:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
I'm trying to override the default apache2.conf config by using VirtualHosts for my actual website directory in /etc/apache2/sites-available/000-default.conf:
<VirtualHost *:80>
ServerAdmin blahblah#123456.so
ServerName 999.999.999.999
DocumentRoot /var/www/html/domains/website1
<Directory /var/www/html/domains/website1>
Options -Indexes +FollowSymLinks
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
The website works just fine but whenever I try to enable SEO friendly URLs, I get a 404 error stating the page does not exist. Here's the .htaccess file located in /var/www/html/domains/website1/ (It's a standard Wordpress .htaccess file):
# 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
Any ideas would be greatly appreciated. Thanks!
Silly me. I figured it out as I was filling out the Tags section of the form and the tag mod-rewrite popped up as one of the suggestions. I needed mod_rewrite enabled! Durp. Well, thanks to the stackoverflow web developers for building that feature into the site :)
I'm trying to configure WordPress permalinks on Linode server running Ubuntu. The permalinks are not working even after doing the basic tricks for configuring them.
.htaccess -file has been given permission "777" and WP has rewritten it:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mydirectory/mysubdirectory/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /mydirectory/mysubdirectory/index.php [L]
</IfModule>
# END WordPress
I have configured "etc/apache2/sites-available/default in a following way:
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride ALL
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride ALL
Order allow,deny
allow from all
</Directory>
<Directory /var/www/mydomin.com/public_html/mydirectory/>
RewriteEngine On
AllowOverride ALL
</Directory>
As you can see I've tried to set "AllowOverride" to different folders. I just gave it a shot, thought that maybe something is overriding the rule for certain folders.
I have ran "a2enmod rewrite" command on Terminal and mod_rewrite is enabled.
I have restarted my Apache every time I've made changes.
When I navigating on my WordPress site I get "Page not found" error. Apache error log says following:
File does not exist: /var/www/mydomain.com/public_html/mydirectory/mysubdirectory/
What am I missing here?
The below settings can go in your VirtualHost directive for the site in question. In most cases this is located in a separate file and referenced from the main conf file for the server.
RewriteEngine On
AllowOverride ALL
Generally speaking you want to keep all of the settings for each site in their own file. So if you need to tweak anything else do it in the file containing the VirtualHost directive for that site. It makes it much easier to troubleshoot/maintain in the future.
I'm been trying to figure this one out for ages but I can't seem to do it. I have an ubuntu 10.04 server with wordpress installed on it. I am trying to make my wordpress use "Pretty" permalinks however every time I try it doesn't seem to work.
This is my apache config:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/wordpress
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/wordpress>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
The .htaccess file is owned by root and it is chmod to 644 (security reasons) and it looks like this:
# 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
Suggestions and a solution would be most welcomed