|
|
|
|
||||||
| alt.apache.configuration Apache web server configuration issues. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello,
I have been trying for 5 hours now to get a simple rewrite to work on the server that hosts our website. I have been through about 20 tutorials on this subjects without results. Here is what I am trying to do. Our website has a URL called example: www.mysite.com/items/product.php?product=1 product=1 refers to our Cedar product. I am trying to reconfigure my ..htaccess file to change to above server side to: www.mysite.com/cedar I have tried all sorts of combinations of code from different authors but none work. I have contacted my hosting company and they ensure me that Mod Rewrites work on thier Apache server. This does not work for me: RewriteEngine on Options +FollowSymlinks RewriteBase / RewriteRule ^cedar$ /items/product.php?product=1 I have tried: without using the ^ * symbols not including the RewriteBase / command wrapping the code inside the <IfModule mod_rewrite.c> tags putting the .htaccess file inside the items folder removing / from in front of /items excluding /items countless other methods Nothing works. I am hoping someone may have some insight into this. Thank you much. Robert |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
"Robert Valcourt" <webmaster@know.spam.customfitonline.com> wrote in message news:7tr0i.169481$DE1.12466@pd7urf2no... > Hello, > > I have been trying for 5 hours now to get a simple rewrite to work on the > server that hosts our website. I have been through about 20 tutorials on > this subjects without results. Here is what I am trying to do. > I know how you feel but it does get easier. > Our website has a URL called example: > > www.mysite.com/items/product.php?product=1 > > product=1 refers to our Cedar product. I am trying to reconfigure my > .htaccess file to change to above server side to: > > www.mysite.com/cedar > > I have tried all sorts of combinations of code from different authors but > none work. I have contacted my hosting company and they ensure me that Mod > Rewrites work on thier Apache server. This does not work for me: > > RewriteEngine on > Options +FollowSymlinks > RewriteBase / > RewriteRule ^cedar$ /items/product.php?product=1 > > I have tried: > > without using the ^ * symbols > not including the RewriteBase / command > wrapping the code inside the <IfModule mod_rewrite.c> tags > putting the .htaccess file inside the items folder > removing / from in front of /items > excluding /items > countless other methods > > Nothing works. I am hoping someone may have some insight into this. Thank > you much. > lol, you have it backwards its RewriteRule source_uri dest_uri if you want to do a direct rewrite from > www.mysite.com/items/product.php?product=1 > www.mysite.com/cedar then its RewriteRule ^items/product\.php\?product=1$ cedar or something similar I think you ultimately, if you know any scripting language, want to rewrite all uri's to a single file and have that file process the uri's... it would probably be much easier if you have a lot of products that your doing this for. note that ? and . are special characters and needs to be escaped with \ so use \. when you mean . in reg expressions . and ? mean anychar and optional. There might be some things I'm getting wrong as I'm new to it too. If you search for mod rewrite there are plenty of tutorials. Its kinda a bitch to get right but usually the problems are from mistakes and not mod rewrite. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On May 9, 10:57 pm, "Robert Valcourt"
<webmas...@know.spam.customfitonline.com> wrote: > Hello, > > I have been trying for 5 hours now to get a simple rewrite to work on the > server that hosts our website. I have been through about 20 tutorials on > this subjects without results. Here is what I am trying to do. > > Our website has a URL called example: > > www.mysite.com/items/product.php?product=1 > > product=1 refers to our Cedar product. I am trying to reconfigure my > .htaccess file to change to above server side to: > > www.mysite.com/cedar > > I have tried all sorts of combinations of code from different authors but > none work. I have contacted my hosting company and they ensure me that Mod > Rewrites work on thier Apache server. This does not work for me: > > RewriteEngine on > Options +FollowSymlinks > RewriteBase / > RewriteRule ^cedar$ /items/product.php?product=1 > > I have tried: > > without using the ^ * symbols > not including the RewriteBase / command > wrapping the code inside the <IfModule mod_rewrite.c> tags > putting the .htaccess file inside the items folder > removing / from in front of /items > excluding /items > countless other methods > > Nothing works. I am hoping someone may have some insight into this. Thank > you much. > > Robert when you say nothing works, do you mean nothing gets rewritten, or it gets rewritten where you dont want it to be. are you sure that rewrites are in fact an option in .htaccess if AllowOverride none is set inside the httpd.conf file, then you will not be able to add any rules using .htaccess files. I see nothing wrong with the .htaccess file you have (when inside the _root_ dir of the site http://www.mysite.com/.htaccess) I added /? and [L] and a couple of other bits in case it made a difference, so you can have urls of the form http://www.mysite.com/cedar/ as well <IfModule mod_rewrite.c> RewriteEngine on Options +FollowSymlinks RewriteBase / RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^cedar/?$ /items/product.php?product=1 [L] </IfModule> all this adds is the test to make sure the cedar doesnt already exist as a directory or file. are you sure you dont have any other rewrites in play. have you tried rewrite logging, and/or deliberate corrupting the rules to see if the server produces an error. clearly if mod_rewrite is not on, then nothing you do in the ifmodule sections will produce an error. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
"Jon Slaughter" <Jon_Slaughter@Hotmail.com> wrote in message news:Xis0i.970$mR2.852@newssvr22.news.prodigy.net. .. > > "Robert Valcourt" <webmaster@know.spam.customfitonline.com> wrote in > message news:7tr0i.169481$DE1.12466@pd7urf2no... >> Hello, >> >> I have been trying for 5 hours now to get a simple rewrite to work on the >> server that hosts our website. I have been through about 20 tutorials on >> this subjects without results. Here is what I am trying to do. >> > > I know how you feel but it does get easier. > >> Our website has a URL called example: >> >> www.mysite.com/items/product.php?product=1 >> >> product=1 refers to our Cedar product. I am trying to reconfigure my >> .htaccess file to change to above server side to: >> >> www.mysite.com/cedar >> >> I have tried all sorts of combinations of code from different authors but >> none work. I have contacted my hosting company and they ensure me that >> Mod >> Rewrites work on thier Apache server. This does not work for me: >> >> RewriteEngine on >> Options +FollowSymlinks >> RewriteBase / >> RewriteRule ^cedar$ /items/product.php?product=1 >> >> I have tried: >> >> without using the ^ * symbols >> not including the RewriteBase / command >> wrapping the code inside the <IfModule mod_rewrite.c> tags >> putting the .htaccess file inside the items folder >> removing / from in front of /items >> excluding /items >> countless other methods >> >> Nothing works. I am hoping someone may have some insight into this. Thank >> you much. >> > > lol, you have it backwards > Oh, nevermind... I guess I got it backwards ;/ |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On May 10, 2:23 am, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote:
> "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote in message > > news:Xis0i.970$mR2.852@newssvr22.news.prodigy.net. .. > > > > > > > "Robert Valcourt" <webmas...@know.spam.customfitonline.com> wrote in > > messagenews:7tr0i.169481$DE1.12466@pd7urf2no... > >> Hello, > > >> I have been trying for 5 hours now to get a simple rewrite to work on the > >> server that hosts our website. I have been through about 20 tutorials on > >> this subjects without results. Here is what I am trying to do. > > > I know how you feel but it does get easier. > > >> Our website has a URL called example: > > >>www.mysite.com/items/product.php?product=1 > > >> product=1 refers to our Cedar product. I am trying to reconfigure my > >> .htaccess file to change to above server side to: > > >>www.mysite.com/cedar > > >> I have tried all sorts of combinations of code from different authors but > >> none work. I have contacted my hosting company and they ensure me that > >> Mod > >> Rewrites work on thier Apache server. This does not work for me: > > >> RewriteEngine on > >> Options +FollowSymlinks > >> RewriteBase / > >> RewriteRule ^cedar$ /items/product.php?product=1 > > >> I have tried: > > >> without using the ^ * symbols > >> not including the RewriteBase / command > >> wrapping the code inside the <IfModule mod_rewrite.c> tags > >> putting the .htaccess file inside the items folder > >> removing / from in front of /items > >> excluding /items > >> countless other methods > > >> Nothing works. I am hoping someone may have some insight into this. Thank > >> you much. > > > lol, you have it backwards > > Oh, nevermind... I guess I got it backwards ;/ dont give it a second thought, most cries for are about rewrites, and although I have been using them as the heart of ajax applications for a couple of years now, and regular expressions for a few years before that - I still spot things that arent right sometimes, I shamefully admit. |
|
![]() |
| Outils de la discussion | |
|
|