Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jan 2012
    Location
    Slovakia
    Posts
    111
    Thanks
    9
    Thanked 0 Times in 0 Posts

    .htaccess url problem

    Hi guys i have two problem first...

    I have url index.php?clanok=something

    I tried

    RewriteRule ^clanok/(.*)$ index.php?clanok=$1 [L]

    Ok that works good but when i try clanok/services ( it doesnt display any images... how i can fix it? i tried in .css full url: http://blabla/images/blabla.jpg and it works ... but ho i can fix everything without the full url? :P thx

    Second problem i have second url: index.php?clanok=blog_obsah&id=34

    How will looks rewriterule???

    _______________________________-

    If somebody will help me i will be really happy i spend more then 50hours with that but without success. Thx :P

  • #2
    New Coder
    Join Date
    Nov 2011
    Posts
    88
    Thanks
    4
    Thanked 26 Times in 26 Posts
    Assuming you are looking to redirect......>>

    Code:
    http://example.null/clanok/blog_obsah/id/32
    redirecting to
    http://example.null/index.php?clanok=blog_obsah&id=32
    AND
    Code:
    http://example.null/clanok/blog_obsah
    redirecting to
    http://example.null/index.php?clanok=blog_obsah
    The simple way (and I've not tested it for major caveats) would be:

    Code:
    RewriteRule ^clanok/(.*)/(.*)/(.*)$ index.php?clanok=$1&$2=$3 [L]
    RewriteRule ^clanok/(.*)$ index.php?clanok=$1 [L]
    NOTE THE ORDER OF THE RULES IS IMPORTANT! If you place them the other way around, it won't work.

  • Users who have thanked leslie.jones for this post:

    Trki (01-18-2012)

  • #3
    Regular Coder
    Join Date
    Jan 2012
    Location
    Slovakia
    Posts
    111
    Thanks
    9
    Thanked 0 Times in 0 Posts

    images

    Quote Originally Posted by leslie.jones View Post
    Assuming you are looking to redirect......>>

    Code:
    http://example.null/clanok/blog_obsah/id/32
    redirecting to
    http://example.null/index.php?clanok=blog_obsah&id=32
    AND
    Code:
    http://example.null/clanok/blog_obsah
    redirecting to
    http://example.null/index.php?clanok=blog_obsah
    The simple way (and I've not tested it for major caveats) would be:

    Code:
    RewriteRule ^clanok/(.*)/(.*)/(.*)$ index.php?clanok=$1&$2=$3 [L]
    RewriteRule ^clanok/(.*)$ index.php?clanok=$1 [L]
    NOTE THE ORDER OF THE RULES IS IMPORTANT! If you place them the other way around, it won't work.

    ah... i did still try something like: ^clanok/(.*)/(.*)/ ( without the thirt ) and ok thx it works... but it still didnt show me a images :/ how would you repair it? :/

    url of image:

    http://example.sk/clanok/services/images/en.png

    and images i have in root directory in /images/example.jpg ... css i have in /css/styles.css and in styles ../images/example.jpg

    and next problem aaarrrghhht when i have to example link index.php?lang=en ( for set english language ) ... how will looks my url? i will need create a next rewriterule
    RewriteRule ^lang/(.*)$ index.php?lang=$1 [L] ?????

    issnt it any univeersal solution? all links and urls in one rule? :/ i have more different links... ah :/ i definetly need universal rule
    Last edited by Trki; 01-18-2012 at 09:41 AM.

  • #4
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You are doing something wrong i cant see what in forum write to me PM and i'll try to fix it.


    nešiojami kompiuteriai apple

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,864
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    but ho i can fix everything without the full url? :P thx
    Use the absolute paths starting with /,to link all elements on client side such as images, css, scripts etc. Have a look at http://www.codingforums.com/showpost...67&postcount=9
    Last edited by abduraooft; 01-18-2012 at 11:34 AM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #6
    New Coder
    Join Date
    Nov 2011
    Posts
    88
    Thanks
    4
    Thanked 26 Times in 26 Posts
    Quote Originally Posted by Trki View Post
    ah... i did still try something like:
    It was nothing, you're very welcome. Thanks for you thanks.

  • #7
    Regular Coder
    Join Date
    Jan 2012
    Location
    Slovakia
    Posts
    111
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    Use the absolute paths starting with /,to link all elements on client side such as images, css, scripts etc. Have a look at http://www.codingforums.com/showpost...67&postcount=9

    thx for help its pity damage that i didnt check forum earlier then i found this solution in my code ... i was thinking what could be bad... i tried replace ./images for /images and it worked... but thx to all of you for help


  •  

    Posting Permissions

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