mod_rewrite not working? possibly not enabled?

i am trying to use the .htaccess to do some URL shorting/clean up. I have
tryed the following test and it does not work. from (http://datakoncepts.com/seo)

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^abc\.html$ abc.php [L]

I also did the

<?php phpinfo(); ?>

test and mod_rewrite was not listed anywhere on the page…

so i contacted my host company and asked if they could enable mod_rewrite and was given the following reply. Any suggestions what to do now, i dont have much of a clue when it comes to apache or installing/modifieing things on the server, but i am curious if it is enabled, why wouldnt it show in phoinfo?

Mod_rewrite is enabled on all our hosting services, you just need to use .htaccess to enable it as your software requires as each script is different.
If you are using Wordpress of the like they give you the htaccess mod_rewrite information.

ok well ive worked out the differnce with the folders :D, and the first example code is working 100%. but i cant get the following to work, the ‘index.php?products=33’ works fine when typed directly, but if i try to ‘example.com/products/33/’ it gives 404 error… any ideas? if the first code works shouldnt this?

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^[b]products[/b]/([0-9]+)/$ /index.php?products=$1 [L]

That’s a question that depends on your host. In other words, you should ask your host :slight_smile:

Are you 100% sure you named the file .htaccess? no typos, no wrong case, etc? And you put it in the website root directory?

The example you provided shows /abc.php when you request /abc.html
Did you request /abc.html when you had the .htaccess in place? What happened?

interesting, i went through and re did the steps and noticed ‘www’ folder, i put the .htaccess in that and it is now working, i tested deleting it from that and it stops working…

can someone give me some tips on this? i have always just uploaded to public_html, whats the differnce with the www folder?

shaunye,

I’m sure you’re smart enough not to use the bb code in your RewriteRule, i.e., and as they’ll be taken literally by mod_rewrite (to require a single b before products and either a / or b after products. I’d also delete the leading / in the redirection as it’ll have Apache looking to the server’s root directory for index.php before looking to you website.

Back to your last problem, typically, the www subdirectory is an alias of the public_html directory. In other words, ignore the www and put all your code in the public_html directory as it’s your DocumentRoot.

Regards,

DK