Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Dec 2004
    Location
    Japan
    Posts
    42

    Default Redirecting to an URL with query string

    When I try to redirect using some query strings such as:

    www.domain1.com redirects to -> www.domain2.com/index.php?referrer=domain1

    Page returns a 404 Not found error because '?' is encoded to '%3f' :
    www.domain2.com/index.php%3freferrer=domain1

    Is there any solution to this?

    thank you.

  2. #2
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Nov 2003
    Location
    moscow
    Posts
    294

    Default

    you cannot redirect url with query string in url using standard cpanel redirect menu. you should look into mod_rewrite technique for realize your requirements. it's not very hard and can done by editing .htaccess file in your web folder. mod_rewrite examples can be found by google.
    Last edited by rustelekom; 01-15-2006 at 09:55 AM.
    https://robobill.net
    US dedicated, Europe and Asia and Russia dedicated server. Shared, Reseller, VPS hosting in US and Europe.
    We are RESELLER of dedicated servers since 2002.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Location
    Royal Oak, Michigan, USA
    Posts
    2

    Question

    I tried to edit the .htaccess file and it did not work. This is the first .htaccess file I have ever edited. Well the edit I did below did not work. Does anyone have any ideas what is wrong? This was a guess edit so to speak, I followed the format of the other redirect that was existing in the .htaccess file prior to any editing.


    Also, why does these query urls not work in cPanel redirects?



    **** Old ".htaccess" file ***

    # -FrontPage-

    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName www.allaroundweb.com
    AuthUserFile /home/aaweb/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/aaweb/public_html/_vti_pvt/service.grp




    RedirectMatch temp ^/portal/$ http://allaroundi.com/
    *** EOF ***

    **** New ".htaccess" file ***

    # -FrontPage-

    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName www.allaroundweb.com
    AuthUserFile /home/aaweb/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/aaweb/public_html/_vti_pvt/service.grp




    RedirectMatch temp ^/portal/$ http://allaroundi.com/

    RedirectMatch temp ^/faqs/$ http://allaroundweb.com/forum/index.php?c=3
    *** EOF ***

    I changed that last line to

    Redirect /faqs http://allaroundweb.com/forum/index.php?c=3

    then

    Redirect /faqs "http://allaroundweb.com/forum/index.php?c=3"

    This is close, but it puts a / at the end

    http://allaroundweb.com/forum/index.php?c=3/
    Thank you,

    danman
    Last edited by danman; 02-07-2006 at 05:17 PM.

  4. #4
    Registered User
    Join Date
    Mar 2002
    Location
    Royal Oak, Michigan, USA
    Posts
    2

    Default Frustrated

    I think I have another way of doing this. I would still like to know why this did not work. Any insight would be apreciated.

    danman

  5. #5
    cPanel Partner NOC cPanel Partner NOC Badge AndyReed's Avatar
    Join Date
    May 2004
    Location
    Minneapolis, MN
    Posts
    2,223

    Default

    Quote Originally Posted by danman
    RedirectMatch temp ^/portal/$ http://allaroundi.com/

    RedirectMatch temp ^/faqs/$ http://allaroundweb.com/forum/index.php?c=3
    *** EOF ***

    I changed that last line to

    Redirect /faqs http://allaroundweb.com/forum/index.php?c=3
    then
    Redirect /faqs "http://allaroundweb.com/forum/index.php?c=3"

    This is close, but it puts a / at the end

    http://allaroundweb.com/forum/index.php?c=3/
    If /faqs is a directory with files in it:
    Code:
    RedirectMatch ^/faqs/.*$ "http://allaroundweb.com/forum/index.php?c=3"
    Andy Reed
    RHCE and CCNA
    ServerTune.com

Similar Threads & Tags
Similar threads

  1. Redirecting to unprotected url
    By its_joy in forum cPanel and WHM Discussions
    Replies: 21
    Last Post: 02-11-2009, 11:35 AM
  2. query string to subdomain
    By kent88 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-13-2008, 12:14 PM
  3. redirecting to an url with ? in it? [moved]
    By HendrikGent in forum New User Questions
    Replies: 3
    Last Post: 10-03-2006, 05:10 PM
  4. phpsuEXEC and url's with query string
    By anup123 in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 06-19-2005, 11:35 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube