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 01-17-2012, 04:02 PM   PM User | #1
Trki
Regular Coder

 
Join Date: Jan 2012
Location: Slovakia
Posts: 108
Thanks: 9
Thanked 0 Times in 0 Posts
Trki is an unknown quantity at this point
.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
Trki is offline   Reply With Quote
Old 01-17-2012, 08:17 PM   PM User | #2
leslie.jones
New Coder

 
Join Date: Nov 2011
Posts: 88
Thanks: 4
Thanked 26 Times in 26 Posts
leslie.jones is an unknown quantity at this point
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.
leslie.jones is offline   Reply With Quote
Users who have thanked leslie.jones for this post:
Trki (01-18-2012)
Old 01-18-2012, 07:16 AM   PM User | #3
Trki
Regular Coder

 
Join Date: Jan 2012
Location: Slovakia
Posts: 108
Thanks: 9
Thanked 0 Times in 0 Posts
Trki is an unknown quantity at this point
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 08:41 AM..
Trki is offline   Reply With Quote
Old 01-18-2012, 10:18 AM   PM User | #4
antuan.o
New to the CF scene

 
Join Date: Jan 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
antuan.o is an unknown quantity at this point
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
antuan.o is offline   Reply With Quote
Old 01-18-2012, 10:30 AM   PM User | #5
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
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
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

Last edited by abduraooft; 01-18-2012 at 10:34 AM..
abduraooft is offline   Reply With Quote
Old 01-18-2012, 11:02 AM   PM User | #6
leslie.jones
New Coder

 
Join Date: Nov 2011
Posts: 88
Thanks: 4
Thanked 26 Times in 26 Posts
leslie.jones is an unknown quantity at this point
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.
leslie.jones is offline   Reply With Quote
Old 01-18-2012, 01:22 PM   PM User | #7
Trki
Regular Coder

 
Join Date: Jan 2012
Location: Slovakia
Posts: 108
Thanks: 9
Thanked 0 Times in 0 Posts
Trki is an unknown quantity at this point
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
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 09:18 AM.


Advertisement
Log in to turn off these ads.