473,503 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regular expression mod_rewrite (htaccess)

I use htaccess to rewrite the url using the following rules :

RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)?$
index.php?lang=$1&page=$2&id=$3

The only problem I have is when http://www.domain.com/admin is given,
the "admin" is used as $1. How can I define the rule for every word
given except "admin" ?

Thanks in advance!

Oct 4 '05 #1
2 2822
"Geradeaus" wrote:
I use htaccess to rewrite the url using the following rules :

RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)?$
index.php?lang=$1&page=$2&id=$3

The only problem I have is when http://www.domain.com/admin is given,
the "admin" is used as $1. How can I define the rule for every word
given except "admin" ?

Thanks in advance!


Use a rewrite condition to exclude this case:
<http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteCond>

Something like this perhaps:
RewriteCond %{REQUEST_URI} !^admin.*$
RewriteRule ...

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
Oct 4 '05 #2
Thanks , that's what I needed :o)

Oct 4 '05 #3

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

Similar topics

4
1879
by: kurt.krueckeberg | last post by:
I am considering going with the ISP Dreamhost because they offers both php4 and php5 support. However, I recently learned php4 runs as a regular CGI by default. This can be change, so it will runs...
11
2032
by: joelbyrd | last post by:
I have a people-networking type site in which each user has their own profile page, with their user id encoded. So, for example, the web address of their page might look like...
3
1963
by: Rik G. | last post by:
I'm trying to replace a PHP query string with virtual directories using Apache's mod_rewrite. Here's my test .htaccess: RewriteEngine on RewriteRule ^qqq$ database.php?cat=0 RewriteRule...
4
2466
by: Hermann.Richter | last post by:
I want to rewrite URLs like http://domain/dir/file.php?var1=val1&var2=val2#anchor to http://domain/dir/file?var1=val1&var2=val2#anchor In other words, I want to strip out the php extension ...
5
4830
by: laredotornado | last post by:
Hi, I have verified that mod_rewrite is enabled on my Apache 2.2 instance. However, now I'm having a problem just serving pages using .htaccess files. Following Rik's advice, my .htaccess file...
0
1242
by: Ja NE | last post by:
I would like to offer my registered users to have very short uri for their pages in our comunity site, so I have enabled wildcard dns *.bellay.com. and added virtaul host for it. (I'm testing this...
2
9237
by: jaanus | last post by:
Here we go... What I have been trying to do is to forward all http requests containing /cms/ to http://cms.mydomain.com/ example1: http://host1.mydomain.com/cms/init.php would be parsed from...
3
1833
by: dennis.sprengers | last post by:
* I'm trying to work out some rewrite rules that should do the following: case 1: a request to mysite.com: rewrite http://www.mysite.com/files/sheets.ppt to...
1
1879
by: macaco | last post by:
I'd like to redirect URLs in a directory in this way: categories/anything/index.php?id=13 to categories/index.php?id=13 To achieve that, I've uploaded a .htaccess file to "categories"...
0
7204
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7091
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...
0
7282
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,...
0
7342
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...
1
6998
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...
0
7464
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5586
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,...
0
3171
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...
0
1516
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 ...

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.