1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

"Catch all" Domain

Discussion in 'Web Design' started by KrasS, Aug 18, 2013.

  1. KrasS

    KrasS BANNED BANNED

    Joined:
    Jan 6, 2009
    Messages:
    109
    Likes Received:
    475
    Hi,

    i need a solution for the following. Lets say i have a url example.com/profile12345 which redirects to a cpa offer. Now a person enters the for example a wrong url lets say example.com/profile12345313 which doesn´t exist and he only gets an error and no redirect. How can i solve this? I just want any url entered to "link" to my rootfolder which includes the redirecting script.

    Hope somebody can help a total n00b.

    Best regards,
    KrasS
     
  2. TheeAriGrande

    TheeAriGrande Regular Member

    Joined:
    Jul 14, 2013
    Messages:
    270
    Likes Received:
    151
    Location:
    Candlestick Park
    You would use the .htaccess file.

    Use this code in your .htaccess file
    Code:
    RewriteEngine on 
    RewriteCond %{REQUEST_FILENAME} !-d
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteRule . index.php [L]
    
    This will redirect any requests of files that DO NOT exist to your index.php. For example, say the an image is getting requested. The image will be the response because the file actually exists. If it didn't exist then the response would come from the index.

    Hope this helps. Let me know if you need a little more help.
     
    • Thanks Thanks x 2
    Last edited: Aug 18, 2013
  3. KrasS

    KrasS BANNED BANNED

    Joined:
    Jan 6, 2009
    Messages:
    109
    Likes Received:
    475
    Thanks you, worked fine :D