Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm having a little trouble getting the standard mod_rewrite that wordpress generates in my directorys .htaccess file to work correctly. The server I'm using has a virtual host set up on it by default, and I'm a little inexperienced configuring them. Ive reached a point where my head hurts from banging it against the wall so any help is appreciated.

so hypothetically, we can say my domain is:

http://domain.com

and I have my wordpress in

http://domain.com/wordpress

so for my pretty links, the .htaccess file that is in domain.com/wordpress reads:

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

and my virtual host config file located at etc/apache2/sites-available/domain.com.conf:

<VirtualHost *:80>
  ServerName app01
  ServerAlias domain.com www.domain.com 
  DocumentRoot /var/www/vhosts/application/

  <Directory /var/www/vhosts/application>
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory> 

  <Directory />
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>

  <Location /server-status>
    SetHandler server-status

    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
  </Location>

  LogLevel info
  ErrorLog /var/log/apache2/domain.com-error.log
  CustomLog /var/log/apache2/domain.com-access.log combined

  RewriteEngine On
  RewriteLog /var/log/apache2/domain.com-rewrite.log
  RewriteLogLevel 0
</VirtualHost>

So when this is working,

a page save as testpage would be reachable at :

http://domain.com/wordpress/testpage

Ive been struggling with this for a while so any help is appreciated!

Cheers!

share|improve this question

1 Answer 1

You're missing a line in your .htaccess.

Start with the standard default .htaccess provided by WordPress, and I think you will find your problems go away.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
share|improve this answer
    
hmmm. that didn't seem to work. when I try to visit domain.com/wordpress/testpage I still get the error Not Found The requested URL /wordpress/testpage was not found on this server. –  Rooster Oct 3 '13 at 4:53
    
Ah, right, both locations need to be changed. Sorry about that. –  Michael Hampton Oct 3 '13 at 4:55
    
both locations? –  Rooster Oct 3 '13 at 5:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.