Google Community
Latest Forums Rules Resources
Custom Search

Go Back   Google Community > Webmaster Forums > Search Engine Optimization Forum

GoogleCommunity Sponsor
Cirtex Hosting
Use coupon "forum" for 50% Off!

Reply
 
LinkBack Thread Tools Display Modes
Old 07-29-2007, 11:15 PM   #1 (permalink)
Senior Googler
 
idansh's Avatar
 
Join Date: May 2007
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
idansh is on a distinguished road
Help with URLRewriter

I am using UrlRewriter from urlrewriter.net and I wanted your help, how to build a rule that will help me resolve the following one:

/images-album/1/2/ ---> images.aspx?cat=1&pg=2

* 1 can be replaced with any number , 1 is where the category id is
* 2 can be replaced with any numner, 2 is where the page number is

pleae help..
idansh is offline   Reply With Quote
 
Sponsored Links
Old 07-30-2007, 01:48 AM   #2 (permalink)
Elite Googler
 
alex-party's Avatar
 
Join Date: Oct 2006
Location: Ireland
Posts: 1,085
Thanks: 0
Thanked 2 Times in 2 Posts
alex-party is an unknown quantity at this point
Peace of cake
Here you go:

Code:
RewriteRule ^images-album/([^/].*)/([^/].*)/$  images.aspx?cat=$1&pg=$2 [NC,L]
alex-party is offline   Reply With Quote
Old 07-30-2007, 02:23 AM   #3 (permalink)
Senior Googler
 
idansh's Avatar
 
Join Date: May 2007
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
idansh is on a distinguished road
<rewriteurl="image-galleries/some_category/([^/].*)"to="images.aspx?pg=$1"/>

i want only one parameter and that the page number but this code doesn't work and error when page loads
please guide me

Last edited by idansh; 07-30-2007 at 02:40 AM.
idansh is offline   Reply With Quote
Old 07-30-2007, 02:39 AM   #4 (permalink)
Elite Googler
 
alex-party's Avatar
 
Join Date: Oct 2006
Location: Ireland
Posts: 1,085
Thanks: 0
Thanked 2 Times in 2 Posts
alex-party is an unknown quantity at this point
I'm not familiar with ASP, so it's hard to understand what that piece of code dose, but I know what you mean. Relative paths will cause problems with mod_rewrite, you should set a variable name in your index file, like:

$img_url=www.example.com/images/

and use it in html like:

<img src="{$img_url}/myimage.jpg" />

If you understand what's happening with mod_rewrites:
a) /images-album/1/2/ -> this is what you see in URL, it's a virtual url and it does not exist, so there are no folders /images-album/1/2/ on your server.
b) images.aspx?cat=1&pg=2 -> this is where the actual script is being executed for this "virtual" url and your $img_url=www.example.com/images/ path should be ABSOLUTE, then you'll always get correct location.

R@
alex-party is offline   Reply With Quote
Old 07-30-2007, 02:46 AM   #5 (permalink)
Senior Googler
 
idansh's Avatar
 
Join Date: May 2007
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
idansh is on a distinguished road
so it makes things more complicated I've read an article here that says that all I should do is make the url of the images like in this form "~/..";

and everything would work fine, but it isn't any suggestion. you don't nee dto know asp , I will tel you that the '~' sign returns the servers root

Any suggestions
idansh is offline   Reply With Quote
Old 07-30-2007, 02:49 AM   #6 (permalink)
Senior Googler
 
idansh's Avatar
 
Join Date: May 2007
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
idansh is on a distinguished road
I need to map the images to their url

that was suggested:

<rewrite url="^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js)(\?.+) ?)$" to="$1" processing="stop" />
idansh is offline   Reply With Quote
Old 07-30-2007, 03:07 AM   #7 (permalink)
Elite Googler
 
alex-party's Avatar
 
Join Date: Oct 2006
Location: Ireland
Posts: 1,085
Thanks: 0
Thanked 2 Times in 2 Posts
alex-party is an unknown quantity at this point
Try this:
<rewriteurl="image-galleries/some_category/([^/].*)/"to="images.aspx?pg=$1"/>

I haven't done url rewrites for the images and paths, because I think it's just very bad idea. I always use set image location in script and then pass it in html and never had any problems.

So what's the problem with css and images? How are paths represented for them in HTML? Is it like "../myimage.jpg" -> you want to convert to "myimage.jpg" ??? You have to give me details where you're images are located and how actual paths in html look like and what path you need to convert it to..
alex-party is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 01:05 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© 2004–2007 Google Community