?
Solved

htaccess 404 with url variables

Posted on 2012-09-07
1
Medium Priority
?
428 Views
Last Modified: 2012-09-14
Hello all,

I am (agian) playing with htaccess. Is there a way to redirect to an 404 page using url parameters?

So for example

www.mysite.nl/site/en/something/andwhatever --> is not found

needs to redirect to

ErrorDocument 404 /site/en/404

but

www.mysite.nl/site/ru/something/andwhatever --> is not found

needs to redirect to

ErrorDocument 404 /site/ru/404

Is there a way to do this?

greetz,
walter
0
Comment
Question by:wal_toor
1 Comment
 
LVL 26

Accepted Solution

by:
arober11 earned 2000 total points
ID: 38377340
Do you have access to the httpd.conf, if yes see:

http://httpd.apache.org/docs/trunk/custom-error.html#multi-lang

If not something along the following lines should do:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule  ^/?site/([a-zA-Z][a-zA-Z])/.*    /site/$1/404   [L]

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month12 days, 16 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question