For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > December 2006 > mod rewrite









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author mod rewrite
Harris Kosmidhs

2006-11-29, 7:58 am

Hello. I have a problem with mod_rewrite.

I have a page article.php where I can call: article.php?id=1

Now I changed it using mod_rewrite so it's article/1

The problem is with the images and other stuff. I solved the problem
with images. Since I want my site to develop it locally I couldn't put
absolute paths. So in every link I use a $rel var which is "/" in the
server and put it to "" locally.

But the problem is when I access file from php. I used to have a
file_exists('pdf/file.pdf')

With mod_rewrite pdf/file.pdf can;t be found. Not can I use
.../pdf/file.pdf due to server limitations.

What's the trick here? How can I do it?

thanks
shimmyshack

2006-11-29, 7:58 am

mod_rewrite affects HTTP requests to the server, but here php is using
the file system, not HTTP, so mod_rewite isnt to blame.
Have you tried using _FILE_ and other such system variables that will
adjust to the server you are on, instead of having to set them yourself.

Harris Kosmidhs

2006-11-29, 7:58 am

shimmyshack wrote:
> mod_rewrite affects HTTP requests to the server, but here php is using
> the file system, not HTTP, so mod_rewite isnt to blame.
> Have you tried using _FILE_ and other such system variables that will
> adjust to the server you are on, instead of having to set them yourself.
>

can you please give me an example or URL? Can;t quite understand how to
use it.
shimmyshack

2006-11-29, 7:58 am

sorry to be so blunt, but I cant do better than this page on "magic
constants"
http://uk2.php.net/manual/en/langua....predefined.php

also if you are using php under apache as a module, why not check out
so called "predefined constants" you have access to as well

http://uk2.php.net/manual/en/langua....predefined.php

there are examples there which I am sure you will find helpful, have
you considered downloading the php manual, the extended version
contains developer comments including code smaples and links to usage
and downloads.

http://uk2.php.net/download-docs.php

-Lost

2006-11-30, 3:57 am

"Harris Kosmidhs" <hkosmidi@remove.me.softnet.tuc.gr> wrote in message
news:ekjtko$f9a$1@volcano1.grnet.gr...

> The problem is with the images and other stuff. I solved the problem with images. Since
> I want my site to develop it locally I couldn't put absolute paths. So in every link I
> use a $rel var which is "/" in the server and put it to "" locally.
>
> But the problem is when I access file from php. I used to have a
> file_exists('pdf/file.pdf')
>
> With mod_rewrite pdf/file.pdf can;t be found. Not can I use ../pdf/file.pdf due to
> server limitations.
>
> What's the trick here? How can I do it?
>
> thanks


RewriteRule \.(css|jpe?g|gif|png|pdf)$ - [L]

This will effectively ignore these files. Assuming mod_rewrite is the actual problem.

-Lost


Gleep

2006-12-01, 6:57 pm

On Wed, 29 Nov 2006 14:13:40 +0200, Harris Kosmidhs <hkosmidi@remove.me.softnet.tuc.gr> wrote:

>Hello. I have a problem with mod_rewrite.
>
>I have a page article.php where I can call: article.php?id=1
>
>Now I changed it using mod_rewrite so it's article/1
>
>The problem is with the images and other stuff. I solved the problem
>with images. Since I want my site to develop it locally I couldn't put
>absolute paths. So in every link I use a $rel var which is "/" in the
>server and put it to "" locally.
>
>But the problem is when I access file from php. I used to have a
>file_exists('pdf/file.pdf')
>
>With mod_rewrite pdf/file.pdf can;t be found. Not can I use
>../pdf/file.pdf due to server limitations.
>
>What's the trick here? How can I do it?
>
>thanks



i had this exact problem solved by placing a base path in the header

<BASE href="http://www.YOURDOMAIN.com/yourFILE.php">
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com