473,785 Members | 2,235 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

modrewrites (different rewrites but same destination - is this possible) ?

hi All,
is it possible to do this?

for instance:

http://www.domain.com/pdisplay.php?p...igrav&type=htm
to
http://www.domain.com/ps2antigrav.html

and

http://www.domain.com/gdisplay.php?p...igrav&type=htm
to
http://www.domain.com/g2antigrav.html

with a modrewrite:

RewriteEngine On
RewriteBase /
RewriteRule ^([^/]+)\.html$ pdisplay.php?pa ge=p2/$1&type=htm
RewriteRule ^([^/]+)\.html$ gdisplay.php?pa ge=g2/$1&type=htm

it basically works for the first one but not the second? Anyone know
why?
cheers,
Andrew

Dec 19 '05 #1
7 1349
Because the first rule is always true -> the both url ends with .html

you must add 1 more check in the rewrite rule, such as

ps2(.*).html$ pdisplay.php?pa ge=p2/ps2$1&type=htm
g2(.*).html$ gdisplay.php?pa ge=g2/g2$1&type=htm

Marco

Dec 19 '05 #2
hi Marco,
thanks for replying, I'm a little confused as to what you mean by
adding another a rewrite? I think I understand why the first rule is
always true but where would I add that extra check in?

RewriteRule ^([^/]+)\ps2(.*).html $ pdisplay.php?pa ge=p2/$1&type=htm

cheers,
Andrew

Dec 20 '05 #3
no no, the rule

RewriteRule ^([^/]+)\ps2(.*).html $ pdisplay.php?pa ge=p2/$1&type=htm

is correct, because you have added the 'ps2' before (.*).html (that is
'1 more check in the rewrite rule' of my previous post. Excuse me for
my bad english, i'm italian :D )

When apache look for a page, example
http://www.domain.com/g2antigrav.html

it find that both rules match :

RewriteRule ^([^/]+)\.html$ pdisplay.php?pa ge=p2/$1&type=htm
RewriteRule ^([^/]+)\.html$ gdisplay.php?pa ge=g2/$1&type=htm

but the first rule is follow.

In that rule
RewriteRule ^([^/]+)\ps2(.*).html $ pdisplay.php?pa ge=p2/$1&type=htm

http://www.domain.com/g2antigrav.html doesn't match, because the name
of the page doesn't start with ps2, so the rule is ignored.

with

RewriteRule ^([^/]+)\g2(.*).html$ pdisplay.php?pa ge=g2/$1&type=htm

the url http://www.domain.com/g2antigrav.html match because the name of
the page starts with g2.

Dec 20 '05 #4
hi Marco,
thanks for your help but unfortunately that extra rule doesn't seem to
work? I'm not sure how to fix the error? Any chance of lending another
hand? :-)
cheers
Andrew

Dec 21 '05 #5
mmm, test this rule:

insert the .htaccess file in you root

RewriteEngine On
RewriteRule ^ps2(.*).html$ pdisplay.php?pa ge=p2/ps2$1&type=htm [L,NC]
RewriteRule ^g2(.*).html$ gdisplay.php?pa ge=g2/g2$1&type=htm [L,NC]

I use rules very similar in most of my website, and they work. Mmm, is
the rewrite engine enabled ?

Dec 22 '05 #6
hi Marco,
thanks mate! It worked PERFECTLY!!!! :) Almost a month later and you
solved my dilemma! Thankyou thankyou! Merry Christmas Marco!
cheers,
Andrew

Dec 23 '05 #7
Perfect :D

Dec 26 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
439
by: Avanish Pandey | last post by:
Hello All We have 3 differen services (in 3 different server) Service A,B,C . We want to implement distributed transaction when call methods of B and C from A. Is it possible? if yes then how? I have read the doc regarding this: http://www.developer.com/net/asp/article.php/3385631 but it will not work when methods are in different services on
47
2706
by: Jeff Relf | last post by:
Hi All, I plan on using the following C++ code to create nodes with unlimited children: // I would like to declare NodeT like this, // but it won't compile because Lnk_T is not defined yet. struct NodeT { Lnk_T Lnk ; };
9
5068
by: Mikhail Teterin | last post by:
Hello! I'd like to have a variable of a pointer-to-function type. The two possible values are of type (*)(FILE *) and (*)(void *). For example: getter = straight ? fgetc : gzgetc; nextchar = getter(file); What type should I give to `getter' so that the compiler does not issue
4
6204
by: | last post by:
I have earlier used an HttpModule that did URL rewrites on the BeginRequest event. Now I am trying to use the same module in a different application on a new and upgraded machine (winxp sp2). The Module is registered via Web.config. The registration is OK. When asking for an existing .aspx page, the eventhandler is called as it should. HOWEVER - if the request url is for a non-existant file, I get a 404 - file
7
1717
by: kris_scheyer | last post by:
Hi, I have a little .exe file that I want the C# code behind of my web application to execute as a different user. The executable is supposed to take a screenshot of the server's display and save the image and it has to be run under the currently logged on user otherwise the generated image just turns out black. My problem is when I click the button on the browser thats supposed to run the exe file a message box appears on the server...
1
1483
by: greg.southerland | last post by:
How would I direct users to a different page based on which radio button they select in a form? Thanks for any help you can provide. Greg
0
1153
by: Harch84 | last post by:
Hi guys need some serious help I have a PostgreSQL database full of bus routes and bus stops. I am drawing them out using perl and manipulating the data. What I need to be able to do is to compare the variables from one query to the variables in another. Allow me to explain further. Firstly all unique routes are selected within a specific distance of my origin point. $originsql = qq{SELECT a.stop_reference, b.service_id,...
16
2358
by: Virtual_X | last post by:
if we use char in a function parameter like that void st(char x) {cout << x;} and char* as a parameter in the same function instead of char x what would be different in my experiments i conclude that
4
2449
by: supriyamk | last post by:
Hi, I am trying to search a directory for subdirectories, recreate the subdirectories elsewhere and copy only certain files from current subdirectory to new subdirectory. In other words i am sorting filetypes into subdirectories with same name. so far i have been able to create the subdirectories, but i am not able to copy the files into those directories. my code is : use strict; use warnings; use File::Glob;
0
9484
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10350
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10097
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.