FAQ: mod_rewrite, 301 redirects, and optimizing Apache.

Discussion in 'Apache' started by Nintendo, Jul 30, 2005.

  1. wavydavy

    wavydavy Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #921
    I am having a lot of issues redirecting referralls from www.thereferrers-site.com.au site to a specific page tailored for visitors from that referred site, for arguments sake lets call that page www.mysite.com.au/thereferrers/pageforthem.html

    Is there an easy way to do this with .htaccess, all the scripts I have tried dont work or break my site (dont know if this has anything to do with regular expressions needed for .com.au tld's that I might be failing to add?)
     
    wavydavy, Nov 19, 2012 IP
  2. tnhcatherine

    tnhcatherine Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #922
    It's a very useful post. Thanks for provide us such a well organized information.
     
    tnhcatherine, Feb 13, 2013 IP
  3. Venkata Nagesh

    Venkata Nagesh Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #923
    Hi All

    I am facing problem with redirect

    www.nagesh.com/ --> This is redirecting to correct page www.venkata.com/en_US/home/pages/home.jsp


    But when I give

    www.nagesh.com/blabla --> www.venkata.com/en_US/home/home.jspblabla


    Where I am going wrong ?
    Can anyone Please suggest !

    Thanks In advance !

    Nagesh
     
    Venkata Nagesh, Mar 20, 2013 IP
  4. Andrey Stroganov

    Andrey Stroganov Peon

    Messages:
    7
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    3
    #924
    remove $1 from rewrite rule and you allways will be redirected to home.jsp without blabla
     
    Andrey Stroganov, Jul 25, 2016 IP
    Nigel Lew likes this.
  5. Sensei.Design

    Sensei.Design Prominent Member

    Messages:
    3,847
    Likes Received:
    162
    Best Answers:
    0
    Trophy Points:
    310
    Digital Goods:
    1
    #925
    I am trying to get rid of the www. redirect when directing to https:// I tried with mod_rewrite but this is causing some errors. Is there any other way this could be setup already I need to remove?
     
    Sensei.Design, May 12, 2020 IP
  6. Zumturtle

    Zumturtle Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #926
    Is the following RewriteCond valid syntax for Apache 2.4?
    RewriteEngine On
        RewriteCond "%{HTTP_ACCEPT}" "application/xrpl-mainnet\+json"
        RewriteRule ^(.+) /.pay/$1.json [L]
    Code (ApacheConf):
    I'm sure the RewriteRule itself is correct because I tested it here: https://htaccess.madewithlove.be/
    The rule maps https://example.com/alice to https://example.com/.pay/alice.json in the tester, but when I deploy the rule in my server <VirtualHost> I get a 404 for alice.json when interacting with a protocol. Strangely, https://example.com/.pay/alice.json can be loaded in a web browser.
     
    Zumturtle, Jun 25, 2020 IP
  7. Zumturtle

    Zumturtle Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #927
    Ignore the post immediately above. It was another issue causing the problem.
     
    Zumturtle, Jun 28, 2020 IP
  8. lukasz_pl

    lukasz_pl Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #928
    Hello,

    I want to change the site address from http://example.com to http://example.com/here without affecting any another rules and adresses. In the other word when someone type "http://example.com" should be redirect to "http://example.com/here" but if someone will use address like http://example.com/images/houses/picture1.jpg that anothre addresses and rules should works as before.

    For some reasons rules like
    RewriteRule ^$ /here [R=301,L] do not works correctly. Any ideas how I can achieve what I want?
     
    lukasz_pl, Mar 1, 2021 IP