Mod_rewrite - Catching URL Paramaters Then Matching Them Using RewriteMap

May 15, 2009

My current URLs look like index.php?order=key, where 'key' is of course the key. I'd like to transform my URLs to a pattern that doesn't currently have any association with the 'key' used in the URL. I'm using the RewriteMap directive to map keys to new values. If I can take the following example URL:-

I'd like to transform index.php?order=hc to /homecare, so I've mapped the key with the value in the two column syntax required within a text file and linked to it.

My initial assumption was that I could then just RewriteRule the variable, but from what I've read I need to use RewriteCond to capture the query_string first.

So, this is my complete ruleset so far:-

RewriteEngine on
RewriteMap rewritemap txt:C:/WINDOWS/system32/inetsrv/rewrite/rewritemap.txt
RewriteCond %{QUERY_STRING}
RewriteRule ^(.*) test.asp?order=${rewritemap:$1}
I'm pretty sure my RewriteRule is correct, but of course there is no rule currently attached to RewriteCond, since I'm unsure what I need to put there.

Would you guys be kind enough to help me out a bit?

View 5 Replies


ADVERTISEMENT

Mod_rewrite RewriteMap

Dec 15, 2005

I have a list of categories that i want to rewrite the URL to display the names instead.

I'm using this:
RewriteMap catlist txt:C:/web/apache2/htdocs/catnames.txt
RewriteRule ^/cats/(.*)$ /categories.php?catid=${catlist:$1|0}

catnames.txt consists of
CategoryName 6
AnotherCatName 8
OnemoreCatName 9
.....
and so on.

This works fine on my local windows PC since i'm using httpd.conf to set this up.
When i use this on my server under .htaccess, the error log says "RewriteMap" not allowed here.
I it only to find out that i cant use RewriteMap under .htaccess... Is there any other alternative to achieve this without listing all the category names with corresponding rewriteurl statements in my .htaccess file?

View 14 Replies View Related

ISAPI Rewrite Filter - Alternatives To RewriteMap

May 14, 2009

we're using IIS 5.0 which doesn't have any flexible support for rewriting URLs which include parameters (AFAIK, anyway). We're currently testing an ISAPI Rewrite Plugin, which emulates the syntax and behaviour of mod_rewrite, which is why I felt this forum category to be the most appropriate for this post.

Our URLs at the moment look like:-

[url]where 'hg' is an instance of a key. In this particular example, we wish to rewrite our URL to read [url]homegarden' where 'homegarden' is a value of that respective key.

Since the value 'homegarden' isn't present in our current URL, we need some way to associate this value with it's relevant key, by mapping one to another. The ideal solution in this case would be to use RewriteMap, however the ISAPI plugin doesn't support this directive.

One other solution, that I've seen here is to use the 'homegarden' value as the key instead. However, due to the lack of flexibility of our system, this isn't possible.

Another method of achieving this is to hard-code a RewriteRule for every instance of a key, but this solution has obvious performance drawbacks (we have around 400 categories)

So, at the moment I'm out of ideas, which is why I thought I'd try and rack your brains for suggestions. An ideal scenario would be to use something like RewriteCond (which is supported by the plugin) to attach a file which would contain the key/value map.

The current supported directives are :-

RewriteRule
RedirectRule
RewriteHeader
RewriteCond
RewriteLog
RewriteLogLevel
RewriteFilterPriority
IterationLimit
MaxMatchCount
StrictParsing

Even if it's not possible using one of the above, maybe someone can point me to solution involving a method other than using this particular plugin?

View 6 Replies View Related

Catching Spam Emails

Jul 25, 2009

We use some spam blockers that come with cPanel but sometimes it feels like it isn't enough to block out all spam coming in and going out of the server. Anyone here have any experience with any other third party softwares that may be able to stop emails in its track basing it on the content of the email itself?

View 4 Replies View Related

RewriteCond Multiple Back Referencing To RewriteMap Variables

May 21, 2009

I have an external redirect to internal rewrite rule that maps multiple URL parameter keys with their associated values...

View 1 Replies View Related

Postfix And Catching Incoming Mail

Dec 11, 2007

write a script which will run a script on every incoming mail, the script must touch a file in /var/log/mail - filename must be a login on server... thats all

i found something to use procmail, but i dont know how to bite it

how to do that? would be nice if you drop some links or tutorials..

always i hate mail servers!

View 1 Replies View Related

Catching A Spamming Virtual Host

Aug 8, 2007

I am managing few virtual domains on a server.

Recently I have seen lots of email activity. Most of the emails are being sent with php scripts which are run under apache. what I want is to catch the culprit domain

so the sender's return path in most cases is root@xxxxx as apache is running under root user.

The server runs plesk admin panel.

I know I can always inspect messages in the queue, qmhandle is good as well to do so. but is there any better way.

e.g. is there a way that instead of emails sent from php scripts with apache user domain name in return path and not root@server etc.

any tools to analyze this activity and then take necessary actions.

View 2 Replies View Related

Cpanel Catching Email Instead Of Google Apps

Apr 2, 2009

This is very perplexing, a few days ago our WHMCS stopped sending email to our google apps account. I soon found out that the server WHMCS is hosted on, that Cpanel is catching all email.

However, we have the DNS set @ everydns.com including a SPF+MX records which worked before on our DirectAdmin server; Our email use to go fine to google apps however it seems like Cpanel is somehow acting as the MX server?

View 6 Replies View Related

Helo Message Not Matching

Aug 28, 2007

I have a dedicated linux/cpanel server running various websites with the shared ip and one website with a dedicated ip.

But when sending mail through sendmail from the dedicated ip website the ip in the helo greeting is not matching the ip of the sender, it is using the main shared ip rather than the dedicated ip which is producing a 550 error from some receiving mail servers. I have racked my brains trying to figure this out and was wondering if anyone else has/had a similar experience and found a solution.

By the way the helo greeting sent in mail from the shared ip websites is fine...

View 2 Replies View Related

Mega Web Server With Matching Data Center

Apr 29, 2008

Does anyone know the secret behind the server configuration of the big boys in hosting who offer as much as 1.5TB webspace and $15TB bandwidth or even unlimited for less than $10/month? I want to offer such a high webspace at less than $10/month too.

I want to know the exact server configuration in terms of hard drives/accessories that can make this possible and very reliable data centers where I can co-locate the servers with unmetered bandwidth too.

The estimated cost of the hard drives/accessories and any other associated costs should be stated clearly.Linux/Unix platforms preferred.The DC should be ready to do the configuration and the cost would not leave a serious dent on my financial resources.

View 8 Replies View Related

Apache :: Redirect Matching First Characters Of URL Using HTAccess

Jun 12, 2013

I want to redirect all the URLs starting from specific characters.

For instance:

www.example.com/abc-apple
www.example.com/abc-bat.html
www.example.com/abc-cat.php

All of the URLs above starts with "abc-" I want a redirect code to redirect all URLs starting from "abc-" to a single URL i.e. www.example.com/allĀ 

View 1 Replies View Related

Plesk 12.x / Linux :: One Subscription Or Any Of Domains Not Showing - Miss Matching Records

Jul 8, 2014

My plesk 12 is working, but one subscription doest show, or any of the domains.

Doing some digging got to this:

[root@server src]# /usr/local/psa/bin/sw-engine-pleskrun check_db_integrity-beta.php
PHP Notice: Undefined variable: PLESK_DB_HOST in /usr/local/src/check_db_integrity-beta.php on line 240
List of records in [psa.domains.cl_id] that miss a matching record in [psa.clients.id]
0
List of records in [psa.dom_level_usrs.dom_id] that miss a matching record in [psa.domains.id]
27, 32, 36, 43, 61, 83, 86

[Code] ....

ERROR: Table "smb_apsImportedResources" is not found in database "psa"!
ERROR: Table "smb_apsImportedResources" is not found in database "psa"!
List of records in [psa.domains.webspace_id, cl_id WHERE webspace_id<>0] that miss a matching record in [psa.domains.id, cl_id WHERE webspace_id=0]
20:1, 52:1, 52:1, 52:1, 68:1

View 1 Replies View Related

How To Show Matching Files In Lower Or UPPERcase With "ls" Command

Mar 27, 2009

I need to show a listing of all files in a directory that match a certain string, with *either* upper or lower case.

So if the contents of the directory are:

FILE1.txt
file1.txt

And then I do an "ls *file*"... I need both files to be in the results.

how can I do this? I couldn't find an "ignore case" switch when doing a "man ls".

View 2 Replies View Related

Account Size Not Matching Real Size

Aug 14, 2008

One of our resellers has an account.. When looking into cpanel, it says that that account is using 3300megs. When we go into the ftp of that account, in reality it is only using 1.3megs. This is a huge difference! Most of folders are empty.
We are using the latest version of WHM and Cpanel.

View 1 Replies View Related

IIS And Mod_rewrite

Jun 12, 2009

I've just moved a few webistes from Linux to Windows and I'm using IIS to run them. Does anybody know of any free alternatives to ISAPI_REWRITE so I can use mod_rewrite per account?

View 8 Replies View Related

Mod_rewrite

Oct 2, 2007

Its October and I have a Server at home with me running NO CONTROL PANEL... I have been using it for 5 years now... But my problem is my mod_rewrite is not working... I have tried fixing it... But I can't find it in the httpd.conf file where I heard it was at... They said it came by default by Apache..

I'm running Apache2.2.4, Fedora Core 7), PHP 5, MySQL 5.... I don't see the mod_rewrite on there....

View 14 Replies View Related

Installing Mod_rewrite?

Sep 8, 2005

I have installed a Apache server version 1.3.33 on windows XP and would like to enable mod_rewrite so i can rewrite my ugly url´s. How do I install this great feature in Apache so i can test it locally?

Do i just remove # from

#LoadModule rewrite_module modules/mod_rewrite.so
#AddModule mod_rewrite.c

View 2 Replies View Related

Mod_rewrite Tracking

May 28, 2008

I've lots of:

[warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored.
[warn] RewriteCond: NoCase option for non-regex pattern '-d' is not supported and will be ignored.

Any ideas how to track them?

View 5 Replies View Related

Does Mod_rewrite Consume RAM?

Oct 24, 2009

does mod-rewrite consume ram?

actually found in new vb discussion of seo friendly urls and mod rewrite was an option for most friendly url, so wanted to know if constant usage of mod-rewrite adds additional load to the server or not?

forum which I and my friends use are pretty big more than 6k in a forum and other above 25k, with 250k posts in 1 forum and 600k posts in the other, so just give me an idea on wat can happen due to constant overwritten?

View 8 Replies View Related

Apache And Mod_rewrite

Mar 29, 2009

So I've setup a server heres the spec provided by Webmin

Operating systemUbuntu Linux 8.10

Webmin version1.470

Time on systemSun Mar 29 18:56:12 2009

Kernel and CPULinux 2.6.27-11-server on i686

System uptime5 days, 19 hours, 42 minutes

I'm struggling with mod_rewrite their seems to be no such thing...

Its not mentioned in the apache2.conf or httpd.conf, httpd.conf was blank previously but I added in certain things to get php working but I cannot get mod_rewrite working, which brings the question forward what else am i missing?

I started out with the aim of blocking the ability of viewing directories.

Quote:

Loaded Modules core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_setenvif mod_status mod_vhost_alias

So how can I go about getting mod_rewrite setup and/or what ever else I'm missing that I might find essential later on once I have everything setup?

View 4 Replies View Related

Lighttpd Mod_rewrite

May 15, 2009

I am struggling to get this .htaccess file to work with lighttpd, i am not a coder so its very hard for me to fix it, hopefully if someone knows how can tell me how to write rewrite code that will get it working.
{quote}

1. Comment the 2 lines below if the server returns 500 errors!
Options -Indexes
Options +FollowSymLinks

#Uncomment following lines if you want to use image caching!
#<IfModule mod_expires.c>

1. ExpiresActive On
2. ExpiresDefault A1209600
3. ExpiresByType text/html A1
#</IfModule>

1. Uncomment following lines if Apache doesnt support MultiViews!
<IfModule mod_rewrite.c>
RewriteEngine On
1. Uncomment the 2 lines below if you are using www.domain.com # as the baseurl for the site and users access your site # via domain.com (THIS IS REQUIRED FOR JQUERY TO WORK)
#RewriteCond %{HTTP_HOST} ^domain.com [NC]
#RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* loader.php [L,QSA]
</IfModule>

1. Edit below lines and set to
2. ErrorDocument CODE /RELATIVE/error.php
3. If the script is installed in the default document
4. root then relative is null.
#ErrorDocument 401 /error.php
#ErrorDocument 403 /error.php
#ErrorDocument 404 /error.php {/quote}

looks like its calling the rule from loader.php file, now how can i convert this to lighttpd language,

View 4 Replies View Related

Php-cgi Isn't Work With Mod_rewrite

Oct 28, 2009

I have been using apache and php-cgi and it works well together but when I tried to use
mod_rewrite it stopped working and I got "Internal Server Error" result.

Apache error log showed "FastCGI: incomplete headers (0 bytes) received from server"

I think that mod_rewrite rules are ok because when I refer to some HTML file then it all works.

Apache 2.2.14 and php 5.2.11

View 5 Replies View Related

Mod_Rewrite (Enable It)

Mar 23, 2008

I have a VPS and I need to enable mod_rewrite.

Here is my PHP Info: [url]

I read a tutorial but I just don't get it. I would appreciate if you could help me out.

I need it for my Wordpress blog.

View 14 Replies View Related

.htaccess Mod_rewrite

May 28, 2008

I'm trying to redirect everything except the subdomains from an old domain to a new domain. The following appears to work so far:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^sub1.olddomain.com$ [NC]
RewriteCond %{HTTP_HOST} !^sub2.olddomain.com$ [NC]
RewriteCond %{HTTP_HOST} !^sub3.olddomain.com$ [NC]
RewriteCond %{HTTP_HOST} !^sub4.olddomain.com$ [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]

But the subdomains also seem to be loading rather slow. Am I doing anything wrong here? Is there any way to optimise or simplify this (I have around 11 subdomains on the old domain)?

View 1 Replies View Related

Mod_Rewrite Subdomain

Aug 31, 2007

I am attempting to redirect any subdomain as follows:

subdomain(dot)domain(dot)com to
domain(dot)com/index.php?user=subdomain

I am having some issues doing this though. None of the samples online seem to work. Do I need a wildcard subdomain? Do I need to do anything to the dedicated linux server I am on? I have other sites on the same server all using mod_rewrite successfully.

Here is what I have so far:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^w{3}. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+).domain.com$ [NC]
RewriteRule ^.*$ /index.php?user=%1 [L]

Is there anything I am missing to get this thing working?

View 3 Replies View Related

PHP-cgi Breaks My Mod_rewrite

Aug 13, 2007

I had the sysadmin install SuPHP - so that my upload script would work properly, however now my mod_rewrite is broken.

You can view the problem here: [url]

It is supposed to show the item with id 29, as you can see. However it shows the gallery index (As if /gallery/ was typed in without the view-29)

The .htaccess file:

Code:
#.htaccess

RewriteEngine On
#This will force trailing slashes
RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule .* - [L]

#RewriteCond %{REQUEST_URI} !^*(css|png|jpe?g|gif)

RewriteRule ^(.+)/(.+)/?$ $1.php?args=$2 [QSA,L]
RewriteRule ^(.+)$ $1.php [QSA,L,NC]
My very framework relies on the .htaccess working this way... I can turn it off, however I would really rather not - so if you have any idea how I can fix this, please do tell.

And on a related note, is it possible to run PHP under a user and not use cgi_php?

View 14 Replies View Related

Mod_rewrite / Lighttpd

Aug 6, 2007

how can I run a equivalent on lighttpd like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

# END WordPress

View 0 Replies View Related

Url Rewriting Or Mod_rewrite For IIS

Apr 3, 2007

I've got a big .htaccess file which works brilliantly in mod_rewrite for apache. However, the client I want to use it for uses a windows server which is based on IIS.

Does anyone have experience with rewriting urls on IIS. Is it easy, could I easily change this:

RewriteCond %{REQUEST_URI} !^/(.+).php$
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{REQUEST_URI} !^/products.php$
RewriteCond %{REQUEST_URI} !^/special-offers.php$
RewriteCond %{REQUEST_URI} !^/best-sellers.php$
RewriteCond %{REQUEST_URI} !^/spares.php$
RewriteCond %{REQUEST_URI} !^/images/
RewriteCond %{REQUEST_URI} !^/css/
RewriteCond %{REQUEST_URI} !^/components/
RewriteCond %{REQUEST_URI} !^/Special_Offers
RewriteCond %{REQUEST_URI} !^/Best_Sellers
RewriteCond %{REQUEST_URI} !^/Spares
RewriteRule ^([^/]+)/?$ products.php?show=cats&main_category=$1

Into something that would work. Someone mentioned using asp.net but I've never looked at this before, and can't afford to spend too long this.

Is there a quick/reliable solution (apart from switching webserver).

View 3 Replies View Related

Netfirms Finally Has Mod_rewrite!

May 1, 2006

Hey guys... Not sure if this was posted yet, couldn't find anything on a first-glance search.

Netfirms has finally added mod_rewrite capabilities as well as better .htacces support! Now I'm completely happy. I was considering switching over to Dreamhost due to the fact that I've started running blog software and messy URLs = crap. Now there's no need. That was pretty much the only thing that was holding me back from a full endorsement, so if anyone's looking for a good cheap hosting plan, here's some of the stuff that I'm really happy about for $5 a month:

- quick, personal customer service (I think there's only 1 or 2 guys, and they always seem to be able to answer my questions on the spot)

- mod_rewrite
- .htaccess
- reliable clean FTP (no _vti files or other annoying folders like so many companies these days)
- good online knowledgebase
- nice online site stats viewer
- a bunch of other great stuff that I probably have forgotten about or don't use
- only $5!

Just thought I'd share in case the news hadn't spread yet. Not sure when they added it, but I noticed the "NEW" sticker today.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved