This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Help to create simple redirect rules
Author
Message |
zaiw
Newbie


Joined: 07 February 2012
Location: Denmark
Posts: 3
Posted: 07 February 2012 at 6:05am

Hi guys,

I have just moved my site from apache with mod_rewrite to IIS6 with isapi_rewrite v.2.

I have the following urls:
http://www.sub.domain.com/nyf/unique-name
http://www.sub.domain.com/nyf/unique-name/
http://www.sub.domain.com/nyf/unique-name/another-unique-name
http://www.sub.domain.com/nyf/unique-name/another-unique-name/
etc.

I want all URL's to be redirected to:
http://www.sub.domain.com/nyf/index.php

which will check if the unique-name is a category, product, article etc.

The rules I used for mod_rewrite was

RewriteEngine on
RewriteRule !\.(gif|jpg|png|css)$ index.php

For isapi_rewrite I use the following rules:

[ISAPI_Rewrite]
RewriteRule (.*/nyf.*) /nyf/index.php/$1 [L]

My problem is that css and images disappears. If I right click on a image and press properties I can see the href of the image. Fx.
http://www.sub.domain.dk/nyf/images/image.png

I have checked and the image exists on that specific path, but the image is not shown on the page. Why is that? And how can I change my rules so it will show the pictures?

Thank you very much in advance.
/Kenneth

 

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 08 February 2012 at 7:11am

Hello, Kenneth

"My problem is that css and images disappears."
- usually this problem occurs if your have relative paths for the resources on pages.
Please consider using root-relative or absolute format for for these links to fix it.

__________________
Regards,
Anton
Back to Top
 
zaiw
Newbie


Joined: 07 February 2012
Location: Denmark
Posts: 3
Posted: 08 February 2012 at 12:18pm

Hi Anton,

The images are not display at all.

I have tried the following:

<img src="http://mysite.com/nyf/images/topbar-tilbage-knap.png" />
<img src="/images/topbar-tilbage-knap.png" />
<img src="/nyf/images/topbar-tilbage-knap.png" />

The files exists in the directory.

BR Kenneth

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 10 February 2012 at 4:18am

Hello, Kenneth

Let's try to fix the config a bit as it doesn't seem to correspond to what you want:

[ISAPI_Rewrite]
RewriteCond URL (?!.*\.(?:gif|jpg|png|css).*).*
RewriteRule /nyf.* /nyf/index.php [I,L]

__________________
Regards,
Anton
Back to Top
 
zaiw
Newbie


Joined: 07 February 2012
Location: Denmark
Posts: 3
Posted: 12 February 2012 at 2:18pm

Hi Anton,

Thats working like a charm. Thanks a lot.

My only problem now is that I cannot retreive the URI.
The user enteres the following address: http://localhost/nyf/Hunde/Hundefoder

When I try to query for the URI in php I only get index.php, which means that I cannot see what the user entered in the URI.

I have tried to change the rule to include /$1 after index.php but without any luck.

How can I retrieve the URI as well?


Thank you so much.

/Kenneth

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 13 February 2012 at 2:22am

Let's try to have it like this:

[ISAPI_Rewrite]
RewriteCond URL (?!.*\.(?:gif|jpg|png|css).*).*
RewriteRule /nyf(/.*) /nyf/index.php$1 [I,L]

__________________
Regards,
Anton
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum