Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0 support forum
 Helicon Tech : ISAPI_Rewrite 3.0 support forum
Subject Topic: rewrite with no querystring Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
scoop
Newbie
Newbie


Joined: 16 April 2008
Online Status: Offline
Posts: 13
Posted: 24 July 2008 at 5:26am | IP Logged Quote scoop

Is it possible to set up a rewrite rule that if there is no querystring to redirect to a url, but also if there is a querystring to direct to another page?

i.e.

jobs.asp to be forwarded to /jobs/search/

jobs.asp?job=skivvy to be forwarded to /jobs/skivvy/

Here is my try

RewriteRule ^jobs/?$ jobs.asp?page=$1 [NC,L]

Thanks for any help
Back to Top View scoop's Profile Search for other posts by scoop
 
Vyacheslav
Moderator Group
Moderator Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 578
Posted: 24 July 2008 at 1:48pm | IP Logged Quote Vyacheslav

Hi Carl.
Please try the following solution:
Code:
RewriteBase /
RewriteCond %{QUERY_STRING} ^job=(.+)$ [NC]
RewriteRule ^jobs\.asp$ jobs/%1/ [NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^jobs\.asp$ jobs/search/ [NC,R=301]


Edited by Vyacheslav - 24 July 2008 at 1:50pm


__________________
Kind regards!
Vyacheslav Shinkarenko, HeliconTech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 
scoop
Newbie
Newbie


Joined: 16 April 2008
Online Status: Offline
Posts: 13
Posted: 25 July 2008 at 3:49am | IP Logged Quote scoop

When I try http://localhost/jobs/search/ I get a page not found, same with http://localhost/jobs/testjob/

If I type http://localhost/jobs.asp it redirects to http://localhost/jobs/search/

I have other rules set up, could they be interfering?

Here is what I have in total

Code:

RewriteLogLevel 9
LogLevel debug

RewriteBase /


RewriteRule ^easyliving/([^/]+)/?$ easyliving.asp?property=$1 [NC,L]
RewriteRule ^About_us/([^/]+)/?$ aboutus.asp?page=$1 [NC,L]
RewriteRule ^Working_here/([^/]+)/?$ careers.asp?page=$1 [NC,L]
RewriteRule ^Working_here/([^/]+)(?:/([^/]+))?/?$ careers.asp?page=$1&subpage=$2 [NC,L]

RewriteCond %{QUERY_STRING} ^job=(.+)$ [NC]
RewriteRule ^jobs\.asp$ jobs/%1/ [NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^jobs\.asp$ jobs/search/ [NC,R=301]


RewriteRule ^([^/]+)/([^/]+)/images/([^/]+)/? /images.asp?type=$1&property=$2&image=$3 [NC,L]


Just looked in the error log and there isn`t anything in there of note just

[25/07/2008 09:19:05] C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf - Loaded successfully


thanks for the help
Back to Top View scoop's Profile Search for other posts by scoop
 
Vyacheslav
Moderator Group
Moderator Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 578
Posted: 25 July 2008 at 4:05am | IP Logged Quote Vyacheslav

Hi Carl.
Excuse me. I have not understood you. Please try the following solution:
Code:
RewriteBase /
RewriteRule ^jobs/(?!search)(.+)/?$ jobs.asp?job=$1 [NC,L]
RewriteRule ^jobs/search/?$ jobs.asp [NC,L]


__________________
Kind regards!
Vyacheslav Shinkarenko, HeliconTech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 

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