views:

34

answers:

3

Hello,

I am trying to put a rewrite rule on .htaccess, but it's not working. Do I need to make a change to php.ini to enable rules to be added to .htaccess?

Thanks in advance,

John

+2  A: 

No, php.ini is specifically related to PHP, .htaccess is Apache.

What are your rules? If it is something like mod_rewrite, then you may need to enable the mod_rewrite module in Apache.

Jason Lewis
How do I enable mod_rewrite?
John
If you're on a shared account, then you won't be able to do it you'll have to get in touch with your host.If, however, you are running it locally and you have something like WAMP installed, it's easy.For WAMP, just click on the icon in the toolbar, go to Apache > Apache Modules and look for mod_rewrite. Then restart Apache.
Jason Lewis
My host just said that it is enabled.
John
Perhaps you should post your rule, because it may be that your rule is wrong.
Jason Lewis
A: 

You have to edit your apache vhost file and allow the .htaccess file to override the settings. This is done by the

AllowOverride 

statement in the directory part of the vhost file. And maybe enabling the mod_rewrite.

TooAngel
A: 

No, .htacces is completely independent of PHP. It is a apache configuration file to modify the configuration for the folder of the .htaccess file.

To enable Rewriting in your .htaccess

RewriteEngine On

To do so you need to enable mod_rewrite in your apache configuration.

UPDATE:

You don't need the above Code in the .htaccess file if you have the following somewhere in your apache config:

<IfModule mod_rewrite.c>  
RewriteEngine on
</IfModule>
jigfox
OK, thanks. How do I enable mod_rewrite?
John
you need to have it installed, it is by default. search for something similar like my update in your `httpd.conf`
jigfox