Solved

HTAccess Question

Posted on 2006-07-24
12
563 Views
Last Modified: 2008-03-10
Hi,

Let's say I have this example:

# Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP:Accept-Language} !^$
RewriteRule ^PAGEVAR.html$ http://www.mysite.com/PAGEVAR [R,L]

It means that anyone with a non-empty language variable will be redirected based on the page they requested.
The example above is what I need, except it's not working.

I.E, the user tries to request PAGEVAR.html on my server, and is then being sent to http://www.mysite.com/PAGEVAR
So that is without .html

Is such a thing possible? Please.

Greeting.
0
Comment
Question by:JimmyJJ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17174507
RewriteCond %{HTTP_ACCEPT_LANGUAGE} !^$
0
 

Author Comment

by:JimmyJJ
ID: 17174558
Hi,

"RewriteRule ^PAGEVAR.html$ http://www.mysite.com/PAGEVAR [R,L]"

Thats what the question is about, hehe.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17174674
and what is the problem about this rule?
"not working" is a bit vage ...
0
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 

Author Comment

by:JimmyJJ
ID: 17174703
Hi,

what i need is that when someone requests the file "example.html",
that he wil be sent to: http://www.mysite.com/example

when someone request the file "anotherexample.html",
he should be sent to: http://www.mysite.com/anotherexample

Greeting,
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17175065
and the condition is an empty Accept-Language?
Also' are yu asking for a wildcard rule (while you posted one with a string literal in your question)?
0
 

Author Comment

by:JimmyJJ
ID: 17175408
I simply copy and pasted the code, I have no idea what it means.

The condition is a non-empty language variable.

If the user is requesting a page that is not defined in the rules, then it should simply display the requested page,
otherwise it shoud send the user to the site associated with the page in the RewriteRules'
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17175915
> .. I have no idea what it means.
why did you use it then?

> The condition is a non-empty language variable.
see my very first comment

> .. is requesting a page that is not defined in the rules ..
so you build one rule for all and every page you have?

JimmyJJ, no offence, but according your description so far, you should first start working out your requirement, then think about a solution, then start makeing used yourself to apache's mod_rewrite to get an idea how to solve some problems, and finally ask for a solution if you still have problems. Or do I miss something?
0
 

Author Comment

by:JimmyJJ
ID: 17176048
OMG, What is this site.
How more do I need to explain this. Someone delete the question and refun the points.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17176358
> OMG, What is this site.
giving qualified answers to proper questions ;-)
I just wanted to enge you to think about your problem and describe it so that we can work on a solution for it.

> How more do I need to explain this
hmm, eithe you didn't explain what's the final problem, or I missed to extract that problem from your writings
How about giving answers to my addition questions, instead of asking new/other questions?
0
 

Author Comment

by:JimmyJJ
ID: 17176502
Hehe, ok well I try one more time. Excuse me for my previous post, it's 100 degrees here.

1) The condition for a redirect is a non-empty language variable.

2) Now, the redirect-to page is based on the requested page.

So if the page "example.html" is being requested by the visitor,
then he should be sent to http://www.othersite.com/example

If he requests "fun.html", then he should be sent to http://www.othersite.com/fun

I thought about it, I think it's easier to set a rule for every page, rather than what I suggested in my first post, namely a redirection based on a part of the filename of the requested page.

If the page that is being requested is not defined in any rule, then he should go to the page that he is requesting.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 245 total points
ID: 17176723
RewriteCond %{HTTP_ACCEPT_LANGUAGE} !^$
RewriteRule ^(example).html$ http://www.othersite.com/$1 [R,L]
RewriteRule ^(fun).html$ http://www.othersite.com/$1 [R,L]
0
 

Author Comment

by:JimmyJJ
ID: 17176862
Ahhhhhh that's it ;-P

Thank you for the code.

Greeting.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

728 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