Wordpress .htaccess issue

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Wordpress .htaccess issue

Postby cbutters » 27. January 2012 20:25

Hello, I am running a xampp 1.7.7 with a current 3.3.1 wordpress installation. xampp is installed to C:\xampp

here is my virtual host information:
<VirtualHost *:80>
ServerAdmin admin@exoid.com
DocumentRoot /xampp/htdocs/www/www.exoid.com
ServerName www.exoid.com
ServerAlias www.exoid.com
AccessFileName /xamp/htdocs/www/www.exoid.com/.htaccess
ErrorLog "/xampp/htdocs/www/www.exoid.com/logs/Errorlog.log"
CustomLog "/xampp/htdocs/www/www.exoid.com/logs/CustomLog.log" combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin@exoid.com
DocumentRoot /xampp/htdocs/www/www.exoid.com
ServerName exoid.com
ServerAlias exoid.com
AccessFileName /xamp/htdocs/www/www.exoid.com/.htaccess
ErrorLog "/xampp/htdocs/www/www.exoid.com/logs/Errorlog.log"
CustomLog "/xampp/htdocs/www/www.exoid.com/logs/CustomLog.log" combined
</VirtualHost>

my issue is that wordpress whenever it goes to rewrite the .htaccess file, it does not write to the .htaccess file in /xamp/htdocs/www/www.exoid.com/, it writes and adjusts a .htaccess file in the root of the c:\ [c:\.htaccess]
The net effect is that the wordpress changes that are written are not used by the website.

How can I make apache use the correct location to write the .htaccess file? I'm stumped.
cbutters
 
Posts: 2
Joined: 27. January 2012 20:20
Operating System: Server 2008

Re: Wordpress .htaccess issue

Postby Sharley » 27. January 2012 22:18

You need to use full paths and tell Apache these vhosts are name based.

You have also duplicated your vhosts and omitted the localhost entry to act as a default.

Also worth a mention is that Apache and most things in XAMPP are case sensitive so try and use only lower case to save confusion and possible simple errors - lower case error and access log file names are the way to go.

Here is an example using an edited copy and paste of your vhost post:
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/xampp/htdocs"
</VirtualHost>

<VirtualHost *:80>
ServerName exoid.com
ServerAlias www.exoid.com
DocumentRoot "C:/xampp/htdocs/www/www.exoid.com"
AccessFileName "C:/xampp/htdocs/www/www.exoid.com/.htaccess"
ServerAdmin admin@exoid.com
ErrorLog "C:/xampp/htdocs/www/www.exoid.com/logs/errorlog.log"
CustomLog "C:/xampp/htdocs/www/www.exoid.com/logs/access.log" combined
</VirtualHost>
Save the file then restart Apache.
See if the above helps and you may copy and paste my edited code.

Notes:
Always check and double check spelling and file and folder case.

When using a fully qualified domain name then you will need to point your DNS to your XAMPP installation PC IP.

If you are just using this domain as a local copy of your hosted domain then you need to also enter the details in the C:\Window\drivers\etc\HOSTS file, for example, the first entries in the file should look similar to this
Code: Select all
127.0.0.1 localhost
127.0.0.1 exoid.com
127.0.0.1 www.exoid.com
That way you will be served your local version of your web site not your hosted version.

Good luck. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Wordpress .htaccess issue

Postby cbutters » 27. January 2012 23:40

Thanks, I took some tips from your post, and things seem to be working now!


Apache really didn't like this line: AccessFileName "C:/xampp/htdocs/www/www.exoid.com/.htaccess"
But I just took it out and using the correct paths like you suggested, it is not writing the htaccess file in funny places.
My new config.
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/xampp/htdocs"
</VirtualHost>

<VirtualHost *:80>
ServerName exoid.com
ServerAlias exoid.com
DocumentRoot "C:/xampp/htdocs/www/www.exoid.com"
   <Directory "C:/xampp/htdocs/www/www.exoid.com">
      DirectoryIndex index.php
      Options Indexes FollowSymLinks Includes ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
   </Directory>
ServerAdmin admin@exoid.com
ErrorLog "C:/xampp/htdocs/www/www.exoid.com/logs/errorlog.log"
CustomLog "C:/xampp/htdocs/www/www.exoid.com/logs/access.log" combined
</VirtualHost>

<VirtualHost *:80>
ServerName www.exoid.com
ServerAlias www.exoid.com
DocumentRoot "C:/xampp/htdocs/www/www.exoid.com"
   <Directory "C:/xampp/htdocs/www/www.exoid.com">
      Options Indexes FollowSymLinks Includes ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
   </Directory>
ServerAdmin admin@exoid.com
ErrorLog "C:/xampp/htdocs/www/www.exoid.com/logs/errorlog.log"
CustomLog "C:/xampp/htdocs/www/www.exoid.com/logs/access.log" combined
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin admin@exoid.com
    DocumentRoot "C:/xampp/htdocs/www/www.exoid.com/phpbb3"
    ServerName forum.exoid.com
    ServerAlias forum.exoid.com
    ErrorLog "C:/xampp/htdocs/www/www.exoid.com/logs/errorlog.log"
    CustomLog "C:/xampp/htdocs/www/www.exoid.com/logs/access.log" combined
</VirtualHost>

cbutters
 
Posts: 2
Joined: 27. January 2012 20:20
Operating System: Server 2008

Re: Wordpress .htaccess issue

Postby Sharley » 28. January 2012 04:24

Once again you have needlessly duplicated your vhosts by not utilizing the ServerAlias correctly.
You do not duplicate the ServerName and the ServerAlias.

Here is a more condensed version and because your sites are contained within the htdocs folder there is no need to add a <Directory> directive unless you want to change the more than adequate defaults that are found in the httpd.conf file and so I have not included the <Directory> directive as I see nothing that is different to the default settings.

Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/xampp/htdocs"
</VirtualHost>

<VirtualHost *:80>
ServerName exoid.com
ServerAlias www.exoid.com
DocumentRoot "C:/xampp/htdocs/www/www.exoid.com"
ServerAdmin admin@exoid.com
ErrorLog "C:/xampp/htdocs/www/www.exoid.com/logs/errorlog.log"
CustomLog "C:/xampp/htdocs/www/www.exoid.com/logs/access.log" combined
</VirtualHost>

<VirtualHost *:80>
ServerName forum.exoid.com
ServerAlias www.forum.exoid.com
DocumentRoot "C:/xampp/htdocs/www/www.exoid.com/phpbb3"
ServerAdmin admin@exoid.com
ErrorLog "C:/xampp/htdocs/www/www.exoid.com/logs/bb3_errorlog.log"
CustomLog "C:/xampp/htdocs/www/www.exoid.com/logs/bb3_access.log" combined
</VirtualHost>
I have also defined the log files for the forum so you can see who is accessing the blog and blog errors separately to the forum access and error logs - this is handy when troubleshooting access and error issues.

Please let me know back if the above causes any issues.

Best wishes. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 134 guests