PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > alt.apache.configuration > .htaccess Apache Mod Rewrites (very frustrated)
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
alt.apache.configuration Apache web server configuration issues.

.htaccess Apache Mod Rewrites (very frustrated)

Réponse
 
LinkBack Outils de la discussion
Vieux 09/05/2007, 22h57   #1
Robert Valcourt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut .htaccess Apache Mod Rewrites (very frustrated)

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


  Réponse avec citation
Vieux 09/05/2007, 23h54   #2
Jon Slaughter
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: .htaccess Apache Mod Rewrites (very frustrated)


"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.






  Réponse avec citation
Vieux 10/05/2007, 02h09   #3
shimmyshack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: .htaccess Apache Mod Rewrites (very frustrated)

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.

  Réponse avec citation
Vieux 10/05/2007, 02h23   #4
Jon Slaughter
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: .htaccess Apache Mod Rewrites (very frustrated)


"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 ;/


  Réponse avec citation
Vieux 10/05/2007, 10h16   #5
shimmyshack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: .htaccess Apache Mod Rewrites (very frustrated)

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.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h48.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,19929 seconds with 13 queries