Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2010
    Location
    India
    Posts
    8

    Apache rewrite rule issue please help me......

    Hello


    I have a domain where i need a redirection as described below :

    i.e

    mydomain.com/t-ABC-048796/sample.jpg

    must redirect to

    mydomain.com/jjj/top/8796/sample.jpg



    As you can see from the source URL (mydomain.com/t-ABC-048796/sample.jpg) i need the last four characters from the directory name

    t-ABC-048796 i.e 8796 . Then it should redirect tocorresponding file under the directory named 8796 (last four characters of directory named t-ABC-048796 ) under mydomain.com/jjj/top/ i.e to the destination URL must be mydomain.com/jjj/top/8796/sample.jpg

  2. #2
    Join Date
    Jan 2011
    Location
    Canada
    Posts
    934
    try

    Code:
    RewriteRule ^/[^/]+([0-9][0-9][0-9][0-9])/(.+)$ /jjj/top/$1/$2 [R,L]

  3. #3
    Join Date
    Dec 2010
    Location
    India
    Posts
    8
    It is not working.......thank`s for reply

  4. #4
    Join Date
    Jan 2011
    Location
    Canada
    Posts
    934
    You might have to strip off the first /

    Code:
    RewriteRule ^[^/]+([0-9][0-9][0-9][0-9])/(.+)$ /jjj/top/$1/$2 [R,L]
    Sorry, the online tester I was using didn't like it either. I should have just listened to it instead of relying on my memory thinking it was a bug.

  5. #5
    Join Date
    Dec 2010
    Location
    India
    Posts
    8
    redirection that you mentioned is not at all working ....... you are wrong


    from this rule i am near to my result and have some problems

    RewriteRule ^t\-SPX\-04\/?(.*)$ "http\:\/\/vstimbers\.com\/jjj\/top\/$1SPX\-04$1.jpg" [R=301,L]


    current result


    http://vstimbers.com/t-SPX-043546/


    is now going to http://vstimbers.com/mas_assets/thum...PX-043546/.jpg



    but i need an output like

    http://vstimbers.com/mas_assets/thum...SPX-043546.jpg


    "/" i need to remove

  6. #6
    Join Date
    Jan 2011
    Location
    Canada
    Posts
    934
    http://vstimbers.com/t-SPX-043546/

    is different in form from the

    http://mydomain.com/t-ABC-048796/sample.jpg

    you mention in your original post, and so is the recombination for the destination filename.

    I'm not really in the mood for hitting a moving target, so please restate clearly what it is you need, multiple examples for the source and destination and then maybe, someone will want to help you.

  7. #7
    Join Date
    Dec 2010
    Location
    India
    Posts
    8
    really it is vitimbers.com

Similar Threads

  1. Simple Apache rewrite rule needed
    By oldunis in forum Hosting Security and Technology
    Replies: 0
    Last Post: 04-08-2010, 10:18 AM
  2. Help w/ Apache Rewrite Rule
    By C4talyst in forum Programming Discussion
    Replies: 1
    Last Post: 11-22-2009, 07:53 PM
  3. rewrite rule
    By cybersavvy in forum Hosting Security and Technology
    Replies: 1
    Last Post: 07-09-2007, 04:20 PM
  4. Apache rewrite issue
    By rhf133 in forum Programming Discussion
    Replies: 3
    Last Post: 02-18-2006, 06:45 PM
  5. rewrite rule works in apache but not htaccess
    By jaymef in forum Hosting Security and Technology
    Replies: 1
    Last Post: 02-14-2006, 03:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •