xampp, permalinks, wordpress and virtual hosts

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

xampp, permalinks, wordpress and virtual hosts

Postby trixienolix » 11. January 2011 14:10

Like other people, I'm having problems getting pretty permalinks to work in WP. (default ones work fine)

My setup is as follows:
wp 3.0.4
xampp for windows 1.7.3
windows 7

I've tried changing the httpd.conf so it now says AllowOverride All in the right places and I've checked that mod_rewrite is running (and it is).
Basically i did everything as written here: http://www.mydigitallife.info/2006/03/08/wordpress-permalinks-does-not-work-in-xampp-setup/
It hasn't worked. I get 404 object not found errors.
I have an .htaccess file that I've tried to make writeable, to no success, so i copy and paste the WP code into it when i try and activate permalinks.
No thing has worked.

I'm now wondering if it is anything to do with the fact that I have also set up virtual hosts (as i have several wp sites i need to develop).
I followed the instructions here: http://ailoo.net/2008/07/set-up-multiple-virtual-hosts-on-xampp-for-windows/
Virtual hosts works fine.

Now when i look at my error log when i try to activate permalinks in wp i'm seeing this line:
[Tue Jan 11 12:50:15 2011] [error] [client 127.0.0.1] File does not exist: X:/_projects/xampp_sites/mysite/xampp
Which makes me think that because I've got virtual hosts, the permalinks is trying to access seomthing that is not there.

Any suggestions please - i need virtual hosts AND permalinks to work, otherwise it's impossible to locally develop wp sites

thanks in advance
trixienolix
 
Posts: 3
Joined: 11. January 2011 13:57

Re: xampp, permalinks, wordpress and virtual hosts

Postby Sharley » 12. January 2011 03:46

You really have no need to edit or change any of the settings in the httpd.conf file from the defaults to run or edit WP and I recommend you revert your httpd.conf file back to the defaults that were established when you installed XAMPP to close any potential security holes.

Make any edits or changes in your VirtualHosts containers only that are configured in your httpd-vhosts.conf file - these are read after the httpd.conf file and so override that httpd.conf file.

The AllowOveride All directive should be added to each of your vhosts that require access to .htaccess file contents ie mod_rewrite entries - the mod_rewrite paths should be correct and would reflect how you have configured the Permalinks in the WP configuration settings.

Paths that are related to Permalinks should perhaps be full URIs or relative paths not paths beginning with a slash, absolute paths - it is clear from your posts that you are having issues defining correct paths in the WP configuration which is beyond the scope of these XAMPP forums.

See your WP Configuration Documentation.

Your issues would normally be more successfully solved by posting in the WP forums where more people having similar issues would read your posts.

Good luck and 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

Re: xampp, permalinks, wordpress and virtual hosts

Postby KiwiDon » 18. January 2011 05:41

Just as a quick post on the topic if your file name for your wordpress installation is "wordpress 304" or "wordpress3.04" the rewrite module won't work.

The file name "wordpress304" will and you may need to manually added a .htaccess file with the following.

# BEGIN WordPress

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

# END WordPress

You will need to remove the # in front of the LoadModule rewrite_module modules/mod_rewrite.so in httpd.conf and change AllowOveride None to "AllowOveride All"

You will also need to turn off and restart XAMPP for it to work, try rebooting you computer if you are having problems after changing the .htaccress file.

Hope that helps.
KiwiDon
 
Posts: 1
Joined: 18. January 2011 04:51

Re: xampp, permalinks, wordpress and virtual hosts

Postby Sharley » 18. January 2011 06:01

KiwiDon wrote:You will need to remove the # in front of the LoadModule rewrite_module modules/mod_rewrite.so in httpd.conf and change AllowOveride None to "AllowOveride All"
This depends on which XAMPP version being used as in XAMPP 1.7.3, the version the OP is using, it is uncommented by default.

You should not change any default AllowOverride directives in the httpd.conf file but rather add this directive
Code: Select all
AllowOverride All
to the .htaccess file placed in the web root of your WP site so it can be actioned on a directory by directory basis or place in each vhost container like so
Code: Select all
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Opening a security hole is possible by changing any of the default httpd.conf file settings unless one is absolutely familiar and knowledgeable about what is being changed.
http://httpd.apache.org/docs/2.2/mod/co ... owoverride

Checking the \xampp\apache\logs\error.log file for any .htaccess errors (usually error 500) will give detailed messages about the errors.


Just to make this clear if you edit the httpd.conf file, which is not required in this case, then restarting the Apache server is the only requirement not a computer reboot.

No need to restart Apache or reboot your computer when editing a .htaccess file as it is read every time it is encountered by the Apache server.

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

Re: xampp, permalinks, wordpress and virtual hosts

Postby trixienolix » 25. January 2011 15:16

Hi thanks for your thoughts on this.

I did not need to change the httpd.conf, as all the # keys were already removed .

I still can't get permalinks to work. I have changed my .htaccess to read this:

Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</IfModule>


and it didn't help (is this what you meant me to do?)

When i turn on permalinks and navigatte to a page, my error log says:
[Tue Jan 25 14:12:16 2011] [error] [client 127.0.0.1] File does not exist: X:/_projects/xampp_sites/mysite/frequently-asked-questions, referer: http://mysite/


Any more suggestions? This problem means I can't effectively build any wp site offline ao i really need it to get sorted

thanks in advance
trixienolix
 
Posts: 3
Joined: 11. January 2011 13:57

Re: xampp, permalinks, wordpress and virtual hosts

Postby Sharley » 26. January 2011 01:47

You are using a VirtualHost with a different DocumentRoot directory structure to the XAMPP default DocumentRoot htdocs folder that most of the tutorials for Permalinks relate to, so mostly they do not apply in your case as the configurations take place in the httpd-vhosts.conf file not in the httpd.conf file - this httpd.conf file should remain in it's installation default state.


trixienolix wrote:...I did not need to change the httpd.conf, as all the # keys were already removed .
That's all good then.

trixienolix wrote:I still can't get permalinks to work. I have changed my .htaccess to read this:
It is not advisable to add any changes to the Wordpress created .htaccess file and I suggest you delete it and have Wordpress create it again - you don't need to worry about write access as in Windows that is already enabled - When creating your Permalinks make sure the path to your web root folder is correct.

Your VirtualHost container for your Wordpress web site is where you add the access permissions and the .htaccess AllowOveride all directives - for example your httpd-vhosts.conf file may look like this
Code: Select all
NameVirtualHost *:80

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

<VirtualHost *:80>
ServerName mysite
ServerAlias www.mysite
DocumentRoot "X:/_projects/xampp_sites/mysite"
<Directory "X:/_projects/xampp_sites/mysite" >
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "X:/_projects/xampp_sites/mysite/cgi-bin/"
ServerAdmin serveradmin@mysite
CustomLog mysiteaccess.log combined
ErrorLog mysiteerror.log
LogLevel error
</VirtualHost>
Change directory paths and mysite server names if not correct in the above example.

Enter in the top of the Windows Hosts file at C:\Windows\system32\drivers\etc\HOSTS - drag into your text editor to edit and save with no file extension.
Code: Select all
127.0.0.1 localhost
127.0.0.1 mysite
Other entries below these.

Access the site index page by typing in the browser http://mysite/
Then access the WP configuration and set the paths not only for Permalinks but for all WP configurations - remember that WP will write the correct .htaccess file to access Permalinks and so no need to add anything at this stage.

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

Re: xampp, permalinks, wordpress and virtual hosts

Postby trixienolix » 26. January 2011 13:14

Ms Sharley thank you for taking the time to understand my problem. Much appreciated.

I have already got the virtual host thing working. In case I've done something wrong, here's the relevant bit of my httpd-vhosts.conf file:
Code: Select all
<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   DocumentRoot X:\_projects\xampp_sites\mysite
   ServerName mysite
   <Directory "X:\_projects\xampp_sites\mysite">
      Options Indexes FollowSymLinks Includes ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   DocumentRoot C:\xampp\htdocs
   ServerName localhost
   <Directory "C:\xampp\htdocs">
      Options Indexes FollowSymLinks Includes ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>


And the relevant bit of my hosts file (by default I have #localhosts and an explanation... is this right?)
Code: Select all
# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
127.0.0.1      mysite


So when i type http://mysite i get the site up fine, WP is there, I've been building the site etc. The problems begin when i try to activate permalinks. If i try and set permalinks to anything other then default i get 404 errors when accessing the pages.

Here's an example:
permalinks in wp admin set to "day and name": http://mysite/2011/01/26/sample-post/
htaccess now reads:
Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

in general settings in wp admin, wordpress url is :http://mysite/wordpress
site url is: http://mysite
navigate to a page and I get a 404 error (EXCEPT for the index page which comes up fine).
Xampp error log says:
Code: Select all
[Wed Jan 26 12:07:16 2011] [error] [client 127.0.0.1] File does not exist: X:/_projects/xampp_sites/mysite/frequently-asked-questions, referer: http://mysite/


Something somewhere is not happy, only I haven't a clue what it is..!
trixienolix
 
Posts: 3
Joined: 11. January 2011 13:57

Re: xampp, permalinks, wordpress and virtual hosts

Postby jingling » 07. February 2012 04:54

I have the same problem. In earlier versions of Xampp and Wordpress it worked, but recent releases it gets broken.
jingling
 
Posts: 2
Joined: 07. February 2012 04:48
Operating System: 2003


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 157 guests