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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 > |
|
|||
|
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 >> > > |