Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
New Member

Custom Error Pages Using .htaccess

Hi All

Im new to Ironport Nation and would like some help setting up custom error pages

I have an Apache server setup with custom errors but am having trouble with my.htaccess and mod_rewrite i believe it needs to be something like

URL
http://proxy.rlc.qld.edu.au/errors/blocked.html?Time=30/Apr/2008:14:29:56%20+1000&ID=0004221698&Client_IP=10.0.0.13&User=-&Site=www.blodddddgstorm.co.uk&URI=htaccess-mod_rewrite-ultimate-guide/&Status_Code=503&Decision_Tag=OTHER&URL_Cat=nc&WBRS=dns&D...

.htaccess
rewriteEngine on
rewriteCond %{query_string} ^URL_Cat=nc&WBRS=dns$
rewriteRule ^errors$ http://proxy.rlc.qld.edu.au/errors/pagenotfound.html [R=301,L]

redirects to
http://proxy.rlc.qld.edu.au/errors/pagenotfound.html

I would also like to incorporate
URL_Cat=nc&WBRS=dns pagenotfound.html
URL_Cat=Adul&WBRS=- adult.html
URL_Cat=Game&WBRS=- games.html
URL_Cat=C_Bloc&WBRS=- custom.html

i know the .htaccess (mod_rewite) is wrong thats where i need help
Thanks in advance

Steve

7 REPLIES
New Member

Re: Custom Error Pages Using .htaccess

Redeemer,

I don't have any previous experience using the mod rewrite. I'm asking around to see if anyone can provide some assistance.

You've probably already seen it, but here is a link to the online manual for this functionality:

http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

I'll see what I can find. No luck yet =)

New Member

Re: Custom Error Pages Using .htaccess

Is there a reason you're trying to use mod_rewrite to do this?

The EUN redirection was designed to be directed to a CGI script, which can then dynamically generate the error page based on the criteria passed in, which allows you to customize the error returned (eg, you can list the full category name which is blocked, for example)

If you really want to have it directing to a static page you can still do this in a CGI script rather than using mod_rewrite.

If you get the config right then mod_rewrite should work, but it's almost certainly going to be overkill...

New Member

Re: Custom Error Pages Using .htaccess

no reason ,
I guess we use mod_rewrite for other things and find it to be an extremely powerful tool and knowing nothing about cgi scripts made it an attractive choice

If cgi is another option would anyone be able to share their script with us

Im still interested to know in the mod_rewrite solution if anyone come across it, im sure it will still be useful

thanks :)

New Member

Re: Custom Error Pages Using .htaccess

If I'm not mistaken, you can just specify multiple RewriteCond/RewriteRule combinations. Something like this:


rewriteEngine on
rewriteCond %{query_string} ^URL_Cat=nc&WBRS=dns$
rewriteRule ^errors$ http://proxy.rlc.qld.edu.au/errors/pagenotfound.html [R=301,L]
rewriteCond %{query_string} ^URL_Cat=adult&WBRS=$
rewriteRule ^errors$ http://proxy.rlc.qld.edu.au/errors/adult.html [R=301,L]

New Member

mod_rewrite custom error pages solved

Thanks Guys
got it sorted this morning once you have mod_rewrite working simply add a condition and rule like the following to .htaccess

RewriteCond %{QUERY_STRING} &?URL_Cat=nc&WBRS=dns&?
RewriteRule ^(.*)$ http://proxy.example.com/errors/pagenotfound.html? [R=301,L]

#Next Condition Rule ect....

so easy :wink:

New Member

Re: Custom Error Pages Using .htaccess

Hi,

Do we have any workaround to hide the transaction ID in URL link?

Alex

New Member

Re: Custom Error Pages Using .htaccess

Do we have any workaround to hide the transaction ID in URL link?


There's no way to hide it, but why would you want to?

From the end users perspective it's a meaningless number that only shown in the URL.

371
Views
0
Helpful
7
Replies
CreatePlease to create content