Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-19-2012, 03:28 PM   PM User | #1
Trki
Regular Coder

 
Join Date: Jan 2012
Location: Slovakia
Posts: 106
Thanks: 9
Thanked 0 Times in 0 Posts
Trki is an unknown quantity at this point
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 05:18 PM..
Trki is offline   Reply With Quote
Old 11-19-2012, 08:59 PM   PM User | #2
poyzn
Regular Coder

 
poyzn's Avatar
 
Join Date: Nov 2010
Posts: 265
Thanks: 2
Thanked 61 Times in 61 Posts
poyzn is on a distinguished road
you have to pass the entire uri to the script (index.php in your case) and then parse it in it
__________________
Ushousebuilders.com
poyzn is offline   Reply With Quote
Old 11-19-2012, 09:25 PM   PM User | #3
Trki
Regular Coder

 
Join Date: Jan 2012
Location: Slovakia
Posts: 106
Thanks: 9
Thanked 0 Times in 0 Posts
Trki is an unknown quantity at this point
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-19-2012 at 11:13 PM..
Trki is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:02 AM.


Advertisement
Log in to turn off these ads.