Need help in HTACCESS url redirection

Discussion in 'Website Development & Design' started by peter90, May 30, 2014.

  1. peter90

    peter90
    uix_expand uix_collapse
    Member

    Joined:
    Apr 12, 2014
    Messages:
    44
    Likes Received:
    0
    Hi,

    How can I redirect my url in HTACCESS.. can anyone let me know because i want to know that how can i do ?

    Regards
    peter
     
  2. RoseAb

    RoseAb
    uix_expand uix_collapse
    Member

    Joined:
    Dec 7, 2013
    Messages:
    87
    Likes Received:
    10
    Following is shortened example of my htaccess file.
    It is pretty complicated in that if you get just one character wrong, it doesn't work. Such as an extra space (2 instead of 1).
    And there are other commands you can use besides this 301 Redirect.

    <IfModule mod_rewrite.c>
    RewriteEngine On
    #
    # Following is renaming by canonical when in home so .php needs to be specified
    Redirect 301 /retardation-mental-treatment /retardation-mental-treatment.php
    Redirect 301 /asthma-treatment /asthma-treatment.php
    Redirect 301 /whooping-cough-treatment /whooping-cough-treatment.php
    </IfModule>
     
  3. peter90

    peter90
    uix_expand uix_collapse
    Member

    Joined:
    Apr 12, 2014
    Messages:
    44
    Likes Received:
    0
    okay .. i hope it will work for me ... because i already wrote some code in htaccess and its is not working .. now i ll try this method.
     
  4. RoseAb

    RoseAb
    uix_expand uix_collapse
    Member

    Joined:
    Dec 7, 2013
    Messages:
    87
    Likes Received:
    10
    Try to get a file working that has just one redirect in it.
    If it doesn't work, post your code and I will try to find the error.
     
  5. AJKpeter

    AJKpeter
    uix_expand uix_collapse
    Member

    Joined:
    Nov 14, 2011
    Messages:
    390
    Likes Received:
    7
    You can also find htaccess redirect generators available online, it will create code for you
     
  6. peter90

    peter90
    uix_expand uix_collapse
    Member

    Joined:
    Apr 12, 2014
    Messages:
    44
    Likes Received:
    0
    okay.. i ll try it but if doesn't work then i ll past code over here.

    - - - - Posts Merged - - - -

    But i already did htaccess redirect generator but that's not working for me .. it showed some different output ..if you know any method then share the code here.
     
  7. Interactiveonlin

    Interactiveonlin
    uix_expand uix_collapse
    Member

    Joined:
    Nov 30, 2011
    Messages:
    155
    Likes Received:
    5
    Why not? For me it generated proper code, just included it and thats it. Maybe you've pasted wrong information
     
  8. mehrishaly

    mehrishaly
    uix_expand uix_collapse
    New Member

    Joined:
    Apr 17, 2014
    Messages:
    21
    Likes Received:
    1
    Add this code

    301 redirection oldpath newpath

    thats it :)
     
    • Like Like x 1
  9. scarlettjack

    scarlettjack
    uix_expand uix_collapse
    New Member

    Joined:
    Apr 22, 2014
    Messages:
    20
    Likes Received:
    1
    This is the very easy code we can do through htaccess thanks mehrish for sharing

     
  10. peter90

    peter90
    uix_expand uix_collapse
    Member

    Joined:
    Apr 12, 2014
    Messages:
    44
    Likes Received:
    0
    may be i tried some different method.. Are you sure they will generate proper code ..Because i don't think so It will generate proper code. By the way, thanks for your information

    - - - - Posts Merged - - - -

    okay ... i also try with this method ..may be it would work for me ..
     
  11. ketusoftware

    ketusoftware
    uix_expand uix_collapse
    Member

    Joined:
    Apr 5, 2014
    Messages:
    64
    Likes Received:
    2
  12. peter90

    peter90
    uix_expand uix_collapse
    Member

    Joined:
    Apr 12, 2014
    Messages:
    44
    Likes Received:
    0
    okay ...Definitely i will visit this link and try this method ...hope so it would work for me..
     
  13. abidasaalim

    abidasaalim
    uix_expand uix_collapse
    New Member

    Joined:
    Apr 24, 2014
    Messages:
    19
    Likes Received:
    0
    301 redirection useoldurlhere usenewurl here

    e.g 301 redirection xyz.html xyz.php
     
  14. zeropid

    zeropid
    uix_expand uix_collapse
    Member

    Joined:
    Oct 24, 2011
    Messages:
    392
    Likes Received:
    12
    So, have you succeed, peter90?
     
  15. hudafaeq

    hudafaeq
    uix_expand uix_collapse
    New Member

    Joined:
    Jun 10, 2014
    Messages:
    24
    Likes Received:
    0
    This is the code I got online you can use it for redirection.

     

Share This Page