Topic: rewrite with no querystring
|

|
| Author |
|
scoop Newbie

Joined: 16 April 2008
Online Status: Offline Posts: 11
|
| Posted: 24 July 2008 at 5:26am | IP Logged
|
|
|
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 |
|
| |
Vyacheslav Moderator Group

Joined: 02 July 2008 Location: Ukraine
Online Status: Offline Posts: 412
|
| Posted: 24 July 2008 at 1:48pm | IP Logged
|
|
|
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.
|
| Back to Top |
|
| |
scoop Newbie

Joined: 16 April 2008
Online Status: Offline Posts: 11
|
| Posted: 25 July 2008 at 3:49am | IP Logged
|
|
|
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 |
|
| |
Vyacheslav Moderator Group

Joined: 02 July 2008 Location: Ukraine
Online Status: Offline Posts: 412
|
| Posted: 25 July 2008 at 4:05am | IP Logged
|
|
|
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.
|
| Back to Top |
|
| |
|
|
If you wish to post a reply to this topic you must first login
If you are not already registered you must first register
|
|
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
|