Redirect

This is a discussion on Redirect within the Apache Web Server forums, part of the Web Server and Related Forums category; If a user requests mydomain.com/Someword/Someotherword and the path does not exist, I want apache to redirect to ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-07-2006
markus w
 
Posts: n/a
Default Redirect

If a user requests mydomain.com/Someword/Someotherword and the path does not
exist, I want apache to redirect to a .php-script which looks up the words
in a database etc.

I'm able to do this using "ErrorDocument 404 error404.php", but there must
be a better way :-)

What is best way to do this?

markus

-----------------------------
Markus Walther
Oslo, Norway


  #2 (permalink)  
Old 10-07-2006
markus w
 
Posts: n/a
Default Re: Redirect

Another option would be redirecting ALL requests to myfile.php. Is that
possible?

markus

-----------------------------
Markus Walther (1064954)
Oslo, Norway
"markus w" <markus@removethis.erfaring.com> wrote in message
news:4527d13c$1@news.broadpark.no...
> If a user requests mydomain.com/Someword/Someotherword and the path does
> not exist, I want apache to redirect to a .php-script which looks up the
> words in a database etc.
>
> I'm able to do this using "ErrorDocument 404 error404.php", but there must
> be a better way :-)
>
> What is best way to do this?
>
> markus
>
> -----------------------------
> Markus Walther
> Oslo, Norway
>



  #3 (permalink)  
Old 10-07-2006
markus w
 
Posts: n/a
Default Re: Redirect

Got it! :-)

# Skip rewriting for

# ... special directories (/img & /js)

# RewriteRule ^/(img|js) - [L]

# ... special extensions (.css & .jpg)

RewriteRule \.(css|jpg|gif)$ - [L]

# Redirect everything (else) to index.php

RewriteRule ^(.*)$ /index.php


markus


-----------------------------
Markus Walther (1064954)
Oslo, Norway
"markus w" <markus@removethis.erfaring.com> wrote in message
news:4527d4e3@news.broadpark.no...
> Another option would be redirecting ALL requests to myfile.php. Is that
> possible?
>
> markus
>
> -----------------------------
> Markus Walther (1064954)
> Oslo, Norway
> "markus w" <markus@removethis.erfaring.com> wrote in message
> news:4527d13c$1@news.broadpark.no...
>> If a user requests mydomain.com/Someword/Someotherword and the path does
>> not exist, I want apache to redirect to a .php-script which looks up the
>> words in a database etc.
>>
>> I'm able to do this using "ErrorDocument 404 error404.php", but there
>> must be a better way :-)
>>
>> What is best way to do this?
>>
>> markus
>>
>> -----------------------------
>> Markus Walther
>> Oslo, Norway
>>

>
>



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:05 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0