mod_rewrite help needed

Posted By: wotan2525 ()
Posted On: 2004-Aug-17 17:17

I am new to these forums, and trying to optimize my rankings. I have a dynamic site (mambo) that does not have search-friendly urls. I've been reading all morning about mod-rewrite, and I think it should be working but its not!

Here is my .htaccess file:

RewriteEngine on
RewriteRule ^option/([A-Za-z]+)/Itemid/([0-9])/$ index.php?option=$1&Itemid=$2


My website is www.usedlasers.com -- thanks for any and all help with this!


Posted By: davaddavad ()
Posted On: 2004-Aug-17 17:53

here is a tutorial maybe the answer lies there. http://www.phpfreaks.com/tutorials/23/0.php
hth dave and welcome to the forums wotan2525


Posted By: wotan2525 ()
Posted On: 2004-Aug-17 21:26

According to everything I read on there, it should be working. I don't have access to the httpd.conf (at least I dont think I do) but phpinfo tells me that it has mod_rewrite as an installed module.... anyone else care to take a guess?


Posted By: landyman ()
Posted On: 2004-Aug-18 00:31

Hi Wotan2525,
There are a couple of things you can try:

Try to put a forward slash before the second part of the Rewrite rule to get:
RewriteEngine on
RewriteRule ^option/([A-Za-z]+)/Itemid/([0-9])/$ /index.php?option=$1&Itemid=$2

Also, the Regular expressions look good, but you could try using (.*) instead foro both of them to see if it is parsing it incorrectly.

If nothing else works, it may be the httpd.conf file. If you have access to .htaccess, then you most likely have access to the httpd.conf file.

Hopefully, one of these will work. I'm not an expert on mod-rewrite... just saying what I know smile


Posted By: wotan2525 ()
Posted On: 2004-Aug-18 16:00

landyman -- thanks for your response.... just tried that and no success. sad I'm putting the .htaccess in the root folder, is this the right place? I've also not been able to find an httpd.conf anywhere.

Thanks again,

Rob


Posted By: landyman ()
Posted On: 2004-Aug-18 18:35

Yes, the .htaccess file should be in your root web folder (the same place as your homepage. If it was not in there before, that might be why it was not working.

As far as the httpd.conf goes -- if you are not the server admin for your site, then you need to contact whoever is, and ask them to check the httpd.conf file for your site to add what you need done to it. If you are the admin for your server, then it is usually in the configuration folder from the Apache install. It can also be called access.conf.
Hope this helps you out and good luck!


Posted By: landyman ()
Posted On: 2004-Aug-18 18:45

One more thing smile
Also I noticed on your site that the Itemid number can be more than one digit. So you will need to change the Regex to [0-9]+ to allow for any number of digits.
According to what I have, code should be:

RewriteEngine on
RewriteRule ^option/([A-Za-z]+)/Itemid/([0-9]+)/$ /index.php?option=$1&Itemid=$2

This will allow for things like Itemid=74 or something like that.