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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2012
    Location
    Slovakia
    Posts
    111
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Rewrite rewritten url

    Hi ... i am confused

    I have this

    PHP Code:
    RewriteEngine On

    RewriteRule 
    ^([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)$ index.php?var1=$1&var2=$2&var3 [L]
    RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$ index.php?var1=$1&var2=$2&var3=$[L]
    RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$ index.php?var1=$1&var2=$[L]
    RewriteRule ^([a-zA-Z0-9]+)$ index.php?var1=$[L
    Which works gr8...

    And it creates url like this

    http://domain.com/blog/Trki

    which is gr8 but i dont want to display this /blog/Trki

    My dreamed url should looks like this: http://domain.com/Trki

    I tried something like this

    RewriteRule ^([a-zA-Z0-9\-]+)/([a-zA-Z0-9\-]+)$ index.php?var2=$2 [L]

    ( i removed the first part but i think it was pretty poor try) :P hm?

    PS: i want to do it just when the 'var1' == blog

    or something like this works too good

    RewriteEngine On
    RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?var1=blog&var2=$1

    but here is the problem that.. if i want to visit /Home .. it takes it like var1=blog&var2=home... i could make some conds. like urls who matchs home or contact or whatever will be redirected but its not practical.
    Last edited by Trki; 11-19-2012 at 06:18 PM.

  • #2
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    you have to pass the entire uri to the script (index.php in your case) and then parse it in it

  • #3
    Regular Coder
    Join Date
    Jan 2012
    Location
    Slovakia
    Posts
    111
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by poyzn View Post
    you have to pass the entire uri to the script (index.php in your case) and then parse it in it
    hm.. sorry what?


    okay i have solved it in different way using php when there was no replies :P
    Last edited by Trki; 11-20-2012 at 12:13 AM.


  •  

    Posting Permissions

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