Non-php files problem

 
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting
View previous topic :: View next topic  
Author Message
Yxine
-


Joined: 26 Jan 2007
Posts: 5

PostPosted: Tue Oct 02, 2007 4:23 pm    Post subject: Non-php files problem Reply with quote

Hello! I have following problem: when useing url rewrite my css, gif and etc file are also rewriting...

I do the following: all my web-site pages have links like:
http://localhost/site1/?page=index
http://localhost/site1/?page=about
http://localhost/site1/?page=news
and so on.

I just want to see them as follows:
http://localhost/site1/
http://localhost/site1/about
http://localhost/site1/news

And I apply next rewriting mechanizm:
Virtual Path Regular Expression: ^/site1/(.*)
Redirect to: /site1/index.php?page=$1
STOP (all other are default)

But when I go to my url http://localhost/site1, all my styles and graphics disappearing from the page output. I fill they also been rewritten, but how to fix that problem?

A bit of code of page:

Code:

<html>
<head>
<link rel="stylesheet" type="text/css" href="style_new.css">


The problem that last line is not loading anymore! Help, please![/code]
Back to top View user's profile Send private message Visit poster's website ICQ Number
roganty
-


Joined: 08 Jun 2004
Posts: 357
Location: Bristol, UK

PostPosted: Wed Oct 03, 2007 6:56 pm    Post subject: Re: Non-php files problem Reply with quote

Yxine wrote:
Hello! I have following problem: when useing url rewrite my css, gif and etc file are also rewriting...

But when I go to my url http://localhost/site1, all my styles and graphics disappearing from the page output. I fill they also been rewritten, but how to fix that problem?

A bit of code of page:

Code:

<html>
<head>
<link rel="stylesheet" type="text/css" href="style_new.css">


The problem that last line is not loading anymore! Help, please!


Yxine,
Its because you are using relative paths.

using your example the browser is asking for /site1/about/style_new.css
but it doesn't exist!

so you have to use absolute paths in your urls so change them to /site1/style_new.css or /site1/image.gif etc
_________________
Anthony R

Roganty
| Links-Links.co.uk
Back to top View user's profile Send private message Visit poster's website
Yxine
-


Joined: 26 Jan 2007
Posts: 5

PostPosted: Thu Oct 04, 2007 9:25 am    Post subject: Re: Non-php files problem Reply with quote

roganty wrote:
so you have to use absolute paths in your urls so change them to /site1/style_new.css or /site1/image.gif etc

Even if I change all my pathes to full, the rewritting engine will make them "bad".

I changed path to style to http://localhost/site1/style.css but it is still rewritting to http://localhost/site1/index.php?page=style.css

Because my rule is rewriting all after /site1/ I think this case is more difficult and requires more rules or conditions...

The only thing that helps if adding any additionsl string to Virtual Path Regular Expression (example: /site1/j/(.*)), but I don't need any j/ in my address and this is the problem.
Back to top View user's profile Send private message Visit poster's website ICQ Number
roganty
-


Joined: 08 Jun 2004
Posts: 357
Location: Bristol, UK

PostPosted: Fri Oct 05, 2007 1:49 am    Post subject: Re: Non-php files problem Reply with quote

Yxine wrote:
I changed path to style to http://localhost/site1/style.css but it is still rewritting to http://localhost/site1/index.php?page=style.css

At least the rewrite rule is working! lol!

Yxine wrote:
Because my rule is rewriting all after /site1/ I think this case is more difficult and requires more rules or conditions...

The only thing that helps is adding any additional string to Virtual Path Regular Expression (example: /site1/j/(.*)), but I don't need any j/ in my address and this is the problem.


Ok, Ive had another look at the regular expression you are using!

You could try the following:
^/site1/([a-zA-Z0-9]*)/?$
So that it only excepts the letters a-z, A-Z and the number 0-9

Or if you only have a limited number of pages you could try
^site1/(about|news)/?$
To add more pages separate them with the pipe character (|)

In both cases i've added "/?$" which basically means:
/ repeated at most once followed by line end

Also as a suggestion you should set up your php page so that it displays the index page by default

Does that help?
_________________
Anthony R

Roganty
| Links-Links.co.uk
Back to top View user's profile Send private message Visit poster's website
Yxine
-


Joined: 26 Jan 2007
Posts: 5

PostPosted: Fri Oct 05, 2007 3:37 am    Post subject: Reply with quote

Thanks! Both rules are working great!
Back to top View user's profile Send private message Visit poster's website ICQ Number
roganty
-


Joined: 08 Jun 2004
Posts: 357
Location: Bristol, UK

PostPosted: Sat Oct 06, 2007 2:05 pm    Post subject: Reply with quote

Yxine wrote:
Thanks! Both rules are working great!


Glad I could help!
_________________
Anthony R

Roganty
| Links-Links.co.uk
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group