Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x support forum
 Helicon Tech : ISAPI_Rewrite 2.x support forum
Subject Topic: I’m new to Rewrite2, need help on Rules Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
horrrst
Newbie
Newbie


Joined: 12 August 2008
Online Status: Offline
Posts: 5
Posted: 12 August 2008 at 8:31am | IP Logged Quote horrrst

Hello,
i'm new to Isapi_Rewrite and have problems finding the right rules for my problems.

The Urls i want to rewrite look normally like this:
/cms/website.php?id=/news/news1.htm
or
/cms/website.php?id=/home.htm
also, there is an additional parameter in some cases
/cms/website.php?id=/home.htm&id=256

I want them to be rewritten as
/news/news1.htm
or
/home.htm

Can somebody help me how to find the right rule for my needs?
Thanks in advance.

regards
horst
Back to Top View horrrst's Profile Search for other posts by horrrst
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7598
Posted: 12 August 2008 at 2:03pm | IP Logged Quote Lexey

RewriteRule ([^?]+\.htm)(?:\?(.*))? /cms/website.php\?id=$1?2&$2 [I,L]
Back to Top View Lexey's Profile Search for other posts by Lexey
 
horrrst
Newbie
Newbie


Joined: 12 August 2008
Online Status: Offline
Posts: 5
Posted: 13 August 2008 at 3:01am | IP Logged Quote horrrst

Thank you sooo much, Lexey! You saved me hours!
This rule is almost working perfect.
I have one little problem with it. When i'm logged into the CMS, and i wan't to add a link or image with the contained WYSIWYG-Editor, i get a 404, because some files couldn't be found.

I think the solution would be, if the rule keeps out rewriting of the folder:
/cms/system/...
So that all files inside the system folder will be found normally.
An example-file is:
http://www.domain.tld/cms/system/tinymce/jscripts/tiny_mce/plugins/advimage/image.htm
Those kind of URIs should not be rewritten.

Can you also help me with this? Thanks sooo much again.

Have a nice day,
horst


Back to Top View horrrst's Profile Search for other posts by horrrst
 
horrrst
Newbie
Newbie


Joined: 12 August 2008
Online Status: Offline
Posts: 5
Posted: 13 August 2008 at 3:43am | IP Logged Quote horrrst

I think i found the solution:
RewriteRule /cms/system(?:/.*)? $0 [I,L]
This rule seems to work!
Regards
horst
Back to Top View horrrst's Profile Search for other posts by horrrst
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7598
Posted: 13 August 2008 at 5:50am | IP Logged Quote Lexey

Yes, that is a possible solution. Another possible solution is the following change of the original rule:

RewriteRule (?!/cms/system(?:$|/))([^?]+\.htm)(?:\?(.*))? /cms/website.php\?id=$1?2&$2 [I,L]
Back to Top View Lexey's Profile Search for other posts by Lexey
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
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