PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > alt.php > mod_rewrite problem
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
mod_rewrite problem

Réponse
 
LinkBack Outils de la discussion
Vieux 30/08/2007, 11h31   #1 (permalink)
luigi7up
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut mod_rewrite problem

Hello everyone,

Im havin' problem with images in pages that were mod_rewrite-n.

So,

/blog/3/

is rewritten into

index.php?kom=blog&id=3

in .htaccess with directives:

RewriteRule ^blog/$ index.php?kom=blog [L]
RewriteRule ^blog/(.*)/$ index.php?kom=blog&id=$1 [L]

but images that have relative path <img src='images/image.jpg' /> are
problem because server appends image path to virtual directory /blog/
3/:

/blog/3/images/image.jpg

where I want it to append that path to the root:

www.domain.com/images/image.jpg

I would like to solve this through .htaccess.

I tried solving this problem with entering apsolute paths to my images
but Im unable to put apsolute path because Im using TinyMCE .js editor
that resolves all absolute paths into relative ones..

Also using slash in front of path (/images/image.jpg) isn't solving my
problem.

I found RewriteRule that should solve my problem but it doesn't work.
Here it is:

RewriteCond %{REQUEST_URI} !\.(exe|jpg|jpeg)$

Maybe Im not using it right, I don't know but this problem gives
headache for quite some
time now.

Thank you in advance

Luka

  Réponse avec citation
Vieux 30/08/2007, 11h32   #2 (permalink)
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mod_rewrite problem

luigi7up wrote:
> Hello everyone,
>
> Im havin' problem with images in pages that were mod_rewrite-n.
>
> So,
>
> /blog/3/
>
> is rewritten into
>
> index.php?kom=blog&id=3
>
> in .htaccess with directives:
>
> RewriteRule ^blog/$ index.php?kom=blog [L]
> RewriteRule ^blog/(.*)/$ index.php?kom=blog&id=$1 [L]
>
> but images that have relative path <img src='images/image.jpg' /> are
> problem because server appends image path to virtual directory /blog/
> 3/:
>
> /blog/3/images/image.jpg
>
> where I want it to append that path to the root:
>
> www.domain.com/images/image.jpg
>
> I would like to solve this through .htaccess.
>
> I tried solving this problem with entering apsolute paths to my images
> but Im unable to put apsolute path because Im using TinyMCE .js editor
> that resolves all absolute paths into relative ones..
>
> Also using slash in front of path (/images/image.jpg) isn't solving my
> problem.
>
> I found RewriteRule that should solve my problem but it doesn't work.
> Here it is:
>
> RewriteCond %{REQUEST_URI} !\.(exe|jpg|jpeg)$
>
> Maybe Im not using it right, I don't know but this problem gives
> headache for quite some
> time now.
>
> Thank you in advance
>
> Luka
>


The problem is you're asking Apache configuration questions in a PHP
newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  Réponse avec citation
Vieux 30/08/2007, 11h59   #3 (permalink)
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mod_rewrite problem

On Thu, 30 Aug 2007 12:31:34 +0200, luigi7up <luigi7up@gmail.com> wrote:

> Hello everyone,
>
> Im havin' problem with images in pages that were mod_rewrite-n.
>
> So,
>
> /blog/3/
>
> is rewritten into
>
> index.php?kom=blog&id=3
>
> in .htaccess with directives:
>
> RewriteRule ^blog/$ index.php?kom=blog [L]
> RewriteRule ^blog/(.*)/$ index.php?kom=blog&id=$1 [L]
>
> but images that have relative path <img src='images/image.jpg' /> are
> problem because server appends image path to virtual directory /blog/
> 3/:
>
> /blog/3/images/image.jpg
>
> where I want it to append that path to the root:
>
> www.domain.com/images/image.jpg
>
> I would like to solve this through .htaccess.


Why? Can't you just use <img src='/images/image.jpg' />?

> I tried solving this problem with entering apsolute paths to my images
> but Im unable to put apsolute path because Im using TinyMCE .js editor
> that resolves all absolute paths into relative ones..


TinyMCE is perfectly configurable.
...
relative_urls: false,
document_base_url : "/",
...

> Also using slash in front of path (/images/image.jpg) isn't solving my
> problem.


It should. What's going wrong.

> I found RewriteRule that should solve my problem but it doesn't work.
> Here it is:
>
> RewriteCond %{REQUEST_URI} !\.(exe|jpg|jpeg)$


Which does not do what you think it does.

>
> Maybe Im not using it right, I don't know but this problem gives
> headache for quite some
> time now.


As said, go for the src='/images/image.jpg' solution.

..htaccess is possible, but very kludgy.

RewriteRule ^blog/images/(.*)$ images/$1 [L]
RewriteRule ^blog/$ index.php?kom=blog [L]
RewriteRule ^blog/(.*)/$ index.php?kom=blog&id=$1 [L]
--
Rik Wasmus

My new ISP's newsserver sucks. Anyone recommend a good one? Paying for
quality is certainly an option.
  Réponse avec citation
Vieux 31/08/2007, 10h15   #4 (permalink)
luigi7up
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mod_rewrite problem

On 30 kol, 12:59, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 30 Aug 2007 12:31:34 +0200, luigi7up <luigi...@gmail.com> wrote:
> > Hello everyone,

>
> > Im havin' problem with images in pages that were mod_rewrite-n.

>
> > So,

>
> > /blog/3/

>
> > is rewritten into

>
> > index.php?kom=blog&id=3

>
> > in .htaccess with directives:

>
> > RewriteRule ^blog/$ index.php?kom=blog [L]
> > RewriteRule ^blog/(.*)/$ index.php?kom=blog&id=$1 [L]

>
> > but images that have relative path <img src='images/image.jpg' /> are
> > problem because server appends image path to virtual directory /blog/
> > 3/:

>
> > /blog/3/images/image.jpg

>
> > where I want it to append that path to the root:

>
> >www.domain.com/images/image.jpg

>
> > I would like to solve this through .htaccess.

>
> Why? Can't you just use <img src='/images/image.jpg' />?
>
> > I tried solving this problem with entering apsolute paths to my images
> > but Im unable to put apsolute path because Im using TinyMCE .js editor
> > that resolves all absolute paths into relative ones..

>
> TinyMCE is perfectly configurable.
> ...
> relative_urls: false,
> document_base_url : "/",
> ...
>
> > Also using slash in front of path (/images/image.jpg) isn't solving my
> > problem.

>
> It should. What's going wrong.
>
> > I found RewriteRule that should solve my problem but it doesn't work.
> > Here it is:

>
> > RewriteCond %{REQUEST_URI} !\.(exe|jpg|jpeg)$

>
> Which does not do what you think it does.
>
>
>
> > Maybe Im not using it right, I don't know but this problem gives
> > headache for quite some
> > time now.

>
> As said, go for the src='/images/image.jpg' solution.
>
> .htaccess is possible, but very kludgy.
>
> RewriteRule ^blog/images/(.*)$ images/$1 [L]
> RewriteRule ^blog/$ index.php?kom=blog [L]
> RewriteRule ^blog/(.*)/$ index.php?kom=blog&id=$1 [L]
> --
> Rik Wasmus
>
> My new ISP's newsserver sucks. Anyone recommend a good one? Paying for
> quality is certainly an option.


Rik,

thank you,

RewriteRule ^blog/images/(.*)$ images/$1 [L]

did what I needed.

Now, could you tell me what would be the use of conditional:

RewriteCond %{REQUEST_URI} !\.(exe|jpg|jpeg)$

Thank you

Luka

  Réponse avec citation
Vieux 31/08/2007, 10h30   #5 (permalink)
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mod_rewrite problem

On Fri, 31 Aug 2007 11:15:57 +0200, luigi7up <luigi7up@gmail.com> wrote:
> On 30 kol, 12:59, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
>> On Thu, 30 Aug 2007 12:31:34 +0200, luigi7up <luigi...@gmail.com> wrote:
>> > Hello everyone,

>>
>> > Im havin' problem with images in pages that were mod_rewrite-n.
>> > /blog/3/
>> > is rewritten into
>> > index.php?kom=blog&id=3

>>
>> > in .htaccess with directives:
>> > RewriteRule ^blog/$ index.php?kom=blog [L]
>> > RewriteRule ^blog/(.*)/$ index.php?kom=blog&id=$1 [L]

>>
>> > but images that have relative path <img src='images/image.jpg' />are
>> > problem because server appends image path to virtual directory /blog/
>> > 3/:

>>
>> As said, go for the src='/images/image.jpg' solution.
>>
>> .htaccess is possible, but very kludgy.
>>
>> RewriteRule ^blog/images/(.*)$ images/$1 [L]
>> RewriteRule ^blog/$ index.php?kom=blog [L]
>> RewriteRule ^blog/(.*)/$ index.php?kom=blog&id=$1 [L]

>
> thank you,
>
> RewriteRule ^blog/images/(.*)$ images/$1 [L]
> did what I needed.


I still urge you to go for the src="/images/etc" solution .

> Now, could you tell me what would be the use of conditional:
>
> RewriteCond %{REQUEST_URI} !\.(exe|jpg|jpeg)$


It is a conditional. You can put that before a RewriteRule, to check
wether the rule should be processed or not. So this:

RewriteCond %{REQUEST_URI} !\.(exe|jpg|jpeg)$
RewriteRule ^blog/(.*)/$ index.php?kom=blog&id=$1 [L]

Would mean:
If the url does NOT end in '.exe','.jpg' or '.jpeg' and starts with
'blog/' then rewrite the url to index.php?kom=blog&id=<whatever comes
after 'blog/'>. It would mean that no rewriting for those extentions would
take place, so it would still search in /blog/images for the (.jp(e)g)
images, no rewriting for those would take place.
--
Rik Wasmus

My new ISP's newsserver sucks. Anyone recommend a good one? Paying for
quality is certainly an option.
  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 11h29.


Édité par : vBulletin® version 3.7.2
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
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15120 seconds with 13 queries