CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Apache configuration (http://www.codingforums.com/forumdisplay.php?f=69)
-   -   .htaccess url problem (http://www.codingforums.com/showthread.php?t=249088)

Trki 01-17-2012 04:02 PM

.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

leslie.jones 01-17-2012 08:17 PM

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.

Trki 01-18-2012 07:16 AM

images
 
Quote:

Originally Posted by leslie.jones (Post 1182055)
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

antuan.o 01-18-2012 10:18 AM

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

abduraooft 01-18-2012 10:30 AM

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

leslie.jones 01-18-2012 11:02 AM

Quote:

Originally Posted by Trki (Post 1182220)
ah... i did still try something like:

It was nothing, you're very welcome. Thanks for you thanks.

Trki 01-18-2012 01:22 PM

Quote:

Originally Posted by abduraooft (Post 1182273)
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 :)


All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.