xamp 1.6.5

tittat

Active Member
Messages
2,478
Reaction score
1
Points
38
hi i am using xamp 1.6.5 for windows.
But i cant use .htaccess files.It is disabled by default.
Can anyone help me on enabling it.
 

rockee

New Member
Messages
120
Reaction score
0
Points
0
Yes the <Directory> default in the httpd.conf is very restrictive.

In the <Directory> directive for your particular site's directory add this:
AllowOverride All

http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride
When this directive is set to None, then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.

When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files.
A typical <Directory> directive in the apache\conf\extra\httpd-vhosts.conf file may look like this:

Code:
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot "C:/mysite"
<Directory "C:/mysite" >
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "C:/mysite/cgi-bin/"
ServerAdmin serveradmin@mysite.com
CustomLog logs/mysiteaccess.log combined
ErrorLog logs/mysiteerror.log
LogLevel error
</VirtualHost>
Before making any changes to a .conf or a .ini file make a backup first.
After making any changes in a .conf file, save, then restart Apache.

Regards,
Rocky
 
Last edited:

tittat

Active Member
Messages
2,478
Reaction score
1
Points
38
Last edited:

rockee

New Member
Messages
120
Reaction score
0
Points
0
Possibly some help here:
http://wordpress.org/search/permalinks+xampp?forums=1

You may be doing something wrong or your .htaccess syntax is not correct - and because you have not included much detail about your configuration, I can only take a guess at what may be mis-configured.

When developing at localhost level you will need to be constantly deleting your browser's cache as this will be one of your worst enemies and a major source of migraine.


If you need some privacy with regard to your configuration files and your .htaccess file then feel free to copy and paste them into a PM and I will take a look at them for you and see if I can spot any issues, also include as much detail as possible to eliminate any guess work on my part, remembering that only you can see your screen and so you have to relay what you can see to anyone trying to troubleshoot your issues.

Your apache error.log file may also hold some clues:
xampp\apache\logs\error.log

In a default XAMPP installation the htdocs directory and any sub directories will allow .htaccess files to be parsed - you only need to add the AllowOverride All to the <Directory> directive if your WP directory is outside the htdocs directory and if this is so then you need to configure the httpd-vhosts.conf file for the default localhost and your WP installation as this file helps to keep you httpd.conf file nice and tidy and easy to follow apart from Apache not allowing web access outside of the htdocs directory by default.


Worth a read and for reference:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html


This is explained in the very old blog link you provided but here it is again.
In apache\conf\httpd.conf file look for this line:
# LoadModule rewrite_module modules/mod_rewrite.so

Uncomment the line by removing the # so it looks like this:
LoadModule rewrite_module modules/mod_rewrite.so

Save the httpd.conf file and restart Apache to have your changes recognized.

Make a backup before editing in case you make a typo.


The .htaccess mod-rewrite rule is written on the fly by WP and so perhaps is not correct syntax and possibly should start like this (WP is orientated to be used on a Linux OS so XAMPP for Windows may need the .htaccess file tweaked a tad):
Options +FollowSymlinks
RewriteEngine on
RewriteBase /

some rules

Check the above link to the Apache docs for details about the RewriteBase directive - the base may need to be /wp/ or some other path for instance (I don't have your paths to work with).

Here is my just created WP Permalink .htaccess file which works for me because I have the Options +FollowSymlinks defined in the <Directory> directive of the wpblg directory in my httpd-vhosts.conf file - if you don't have that Options entry in your wp <directory> directive then add it to your Permalink .htaccess file as displayed above.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wpblg/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wpblg/index.php [L]
</IfModule>

# END WordPress



BTW only uncomment those modules in the htdocs.conf file that you know you require as you may find you have more errors than you can cope with if you uncomment all the module entries.



Also check in the php.ini file that register_globals is set to Off as I am not sure what version of XAMPP they changed the default setting from On to Off.

xampp\apache\bin\php.ini

About line 391
register_globals = On

change to
register_globals = Off

Save the file and restart Apache - remember to always backup first.



Off Topic Tip
Another tip that may help in the future - if you have to edit the php.ini file for any reason, the php.ini file is located in the xampp\apache\bin directory not in the xampp\php directory - Apache on XAMPP is compiled as a module, which is different from the method used on X10.

Also you can include php directives in a .htaccess file on a directory by directory basis in XAMPP which again is different to the way X10 behaves.

Always save the php.ini file and then restart Apache, as Apache only reads the php.ini file once when Apache starts and again this is different behavior than that used by the Apache compile in X10.



Don't forget to PM me with any details you need to keep private but for the sake of this thread's completeness, I suggest that when this issue is sorted a post with what was needed to get the Permalinks in WP working on XAMPP should be written.

Regards,
Rocky
 
Last edited:

tittat

Active Member
Messages
2,478
Reaction score
1
Points
38
sorry for not mentioning it earlier i am not using WP but e107.I went for WP tutorial because i cant find anyhing for e107.







in php.ini it is default to register_globals = Off so i made no changes



i edited D:\xampp\apache\conf\httpd.conf
on line 118 #LoadModule rewrite_module modules/mod_rewrite.so

is changed to

LoadModule rewrite_module modules/mod_rewrite.so (my apache refused to restart after i made changes on this line.But apache restarted when i add # back)


line 331 AllowOverride None
is changed to
AllowOverride All

line 188 AllowOverride None
is changed to AllowOverride All

the edited httpd.conf file is attached with this post.




my .htacces file contains the following information.

RewriteEngine On

RewriteRule home.html news.php [L]
RewriteRule index.html news.php [L]
RewriteRule index.htm news.php [L]
RewriteRule default.html news.php [L]
RewriteRule default.htm news.php [L]

RewriteBase /

# ===============================================
# NEWS ==========================================
RewriteRule news.html$ news.php [L]
RewriteRule news([0-9]*)-([0-9]*)\.html(.*)$ news.php?$1.$2 [L]
RewriteRule news([0-9]*)-([0-9]*)-([0-9]*)\.html(.*)$ news.php?$1.$2.$3 [L]
RewriteRule news-i([0-9]*)-([0-9]*)\.html(.*)$ news.php?item.$1.$2 [L]
RewriteRule news([0-9]*)\.html(.*)$ news.php?extend.$1 [L]
RewriteRule news-c([0-9]*)\.html(.*)$ news.php?cat.$1 [L]
RewriteRule news-c([0-9]*)-([0-9]*)\.html(.*)$ news.php?cat.$1.$2 [L]





the relevant errors in my log file is
[alert] [client 127.0.0.1] D:/xampp/htdocs/kaumar/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration








i am using xampp version 1.6.5
My operating system is windows xp sp-2.
i access my site locally as http://localhost/kaumar (i.e D:\xampp\htdocs\kaumar)




Can you please guess where the problem might be by reading error log.


thanks again and again
 

Attachments

  • httpd_edited.txt
    19.3 KB · Views: 80
Last edited:

rockee

New Member
Messages
120
Reaction score
0
Points
0
Thanks for including the verbose details - it makes troubleshooting so much easier.


This is how the .htaccess should look for best results and it should flow now - remember to empty your browser's cache frequently.
Options +FollowSymlinks
RewriteEngine On
RewriteBase /kaumar/
RewriteRule home.html news.php [L]
RewriteRule index.html news.php [L]
RewriteRule index.htm news.php [L]
RewriteRule default.html news.php [L]
RewriteRule default.htm news.php [L]
RewriteRule news.html$ news.php [L]
RewriteRule news([0-9]*)-([0-9]*)\.html(.*)$ news.php?$1.$2 [L]
RewriteRule news([0-9]*)-([0-9]*)-([0-9]*)\.html(.*)$ news.php?$1.$2.$3 [L]
RewriteRule news-i([0-9]*)-([0-9]*)\.html(.*)$ news.php?item.$1.$2 [L]
RewriteRule news([0-9]*)\.html(.*)$ news.php?extend.$1 [L]
RewriteRule news-c([0-9]*)\.html(.*)$ news.php?cat.$1 [L]
RewriteRule news-c([0-9]*)-([0-9]*)\.html(.*)$ news.php?cat.$1.$2 [L]
No need for an Options directive in the .htaccess file as the htdocs directory and it's sub-directories are covered by the defaults in the httpd.conf file - but I have included it just in case and it will not affect the flow of the .htaccess file.

mod_rewrite will not work unless the module is enabled in the httpd.conf file and this is evident from your error.log file message.

Apache may not be starting because of the htaccess fault with the mod_rewrite syntax, as outlined in the error.log

Make sure that mod_rewrite.so is in the D:\xampp\apache\modules directory.


If your Apache server won't start by using the Control Panel then use the D:\xampp\apache_start.bat file as it will give you feedback in the form of an error message why apache won't start.

To check the syntax of your httpd.conf file, open a command prompt in the D:\xampp\apache\bin directory and issue the command apache -t

For a command prompt in XP click on start on the task bar.
Click on Run...
Type cmd
Click OK
Type cd d:\xampp\apache\bin
Press Enter key
Type apache -t
Press Enter key

The returned message, after replacing the httpd.conf file with the one I attached, may look similar to this if all is OK with the httpd.conf file:
C:\xampp\apache\bin>apache -t
[Mon May 05 09:12:20 2008] [notice] Disabled use of AcceptEx() WinSock2 API
Syntax OK
Note
I have added this line to the end of your attached modified httpd.conf file as sometimes not having this can course issues with XP:
Win32DisableAcceptEx
If you feel it is not what you want then all you need do is comment it out. but my advise is to leave it enable.


Line 331 is to secure your cgi-bin and if a .htaccess file is allowed in there then you will be in all sorts of security trouble not only in your XAMPP installation but also on your PC.
So this should be returned to the default ASAP.
<Directory "D:/xampp/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>


Line 108 should also be returned to it's default as the restrictive behavior for any directory outside your htdocs directory prevents those script kiddies from accessing any directory on your PC from the Internet via your Apache server - this is a major security feature and should not be changed.

The restrictions are eased on a directory by directory basis for maximum control by the server's admin, you.

The htdocs directory is one example and for your needs with the sub-directory koumar is set correctly as those configurations are for the htdocs directory and it's sub-directories.

Line 108 defaults look like this:
<Directory>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
The default httpd.conf file is the preferred as it is set for securing your server as best it can - so if you are using the htdocs directory then usually there is no need to change anything other than enabling the modules you may require.


This part of the httpd.conf file at about line 245 was maybe the problem with you not being able to access a .htaccess file.
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>

AccessFileName .htaccess
The AccessFileName .htaccess was missing in your httpd.conf file.

I have re-edited your httpd.conf file with all the above mentioned changes, fixed another couple of small errors I spotted and attached it to the reply.
Regards,
Rocky
 

Attachments

  • httpd_re-edited.txt
    19.4 KB · Views: 65

tittat

Active Member
Messages
2,478
Reaction score
1
Points
38
rockee its working now.................
thanks a lot for you support.
thanks for all those support.
kisses for you......



i just sent you a small present........
 
Last edited:

rockee

New Member
Messages
120
Reaction score
0
Points
0
Thanks tittat, I am more than pleased that you have now got it working - oh! what a feeling. :)

Now you can move on.

Regards,
Rocky
 
Top