vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Mod Rewrite - Image Paths (https://vborg.vbsupport.ru/showthread.php?t=93547)

Adrian Schneider 08-03-2005 06:38 PM

Mod Rewrite - Image Paths
 
Basically I have /vb35rc1/blogs/username/ rewritten as /vb35rc1/blog.php?do=viewblog&un=username, but all my image paths point to /vb35rc1/blogs/username/images/. I looked up on google and found something like:
Code:

rewriteRule /vb35rc1/blogs/(.*)/images/ /vb35rc1/images/ [L]
Not much luck there though, under view source I see images/(image) now, but the images still won't show. Any pointers?

Thanks

akanevsky 08-03-2005 08:29 PM

Try the following:

Code:

rewriteBase /
rewriteRule ^vb35rc1/blogs/([A-z0-9\-\_]*)/images/([A-z0-9\-\_]*)$ vb35rc1/images/$2


Dean C 08-03-2005 08:31 PM

You should start from scratch with these rules. Particularly because you are allowing the (.*) everything atom. mod_rewrite is a great first line of defence against hacking attempts so it's always best to specify what you want to put in the parentheses.

What exactly will go in the place of the (.*)'s :)?

Adrian Schneider 08-03-2005 09:27 PM

Thanks DV

Their username will go there of course, Dean.

Dean C 08-03-2005 09:43 PM

Code:

RewriteBase /
RewriteRule ^vb35rc1/blogs/([A-Za-z0-9-_]+)/images/([A-Za-z0-9-_]+)/?$ vb35rc1/images/$2 [L]

That's a cleaned up version of Dark's code. There's no need to escape characters within the character classes in mod_rewrite. Also needed to add an optional trailing slash otherwise when users add a / on the end of your URL it'll break. I'm having trouble trying to see exactly what you are doing here though...

Adrian Schneider 08-03-2005 09:56 PM

Cleaning URLs for blogging, but the image paths got all messed up after. All my rewrites work fine on my other site, just not the vB one because of how the images are setup.

Dean C 08-04-2005 08:37 AM

So do users have their own collection of images or something?

Adrian Schneider 08-04-2005 04:00 PM

No - so instead of having to type blog.php?do=view&u=1 they have to type /blogs/aj/ , just the result of doing so messed up the image paths (of course not just for me, for all users;))

Dean C 08-04-2005 04:13 PM

In that case the above rule will not work. Use this:

Code:

RewriteEngine On
RewriteBase /
RewriteRule ^blogs/([A-Za-z0-9-_]+)/?$ blog.php?do=view&u=$1 [L]

That will assume that you pass the username to $_REQUEST[u]

RewriteBase will fix your problems with the image paths. put it in your vb3rc1 directory in a .htaccess file :)

Adrian Schneider 08-04-2005 04:50 PM

Hmm..
Quote:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Apache/1.3.33 Server at localhost Port 80
Code:

RewriteEngine On
RewriteBase /
RewriteRule ^blogs/([A-Za-z0-9-_]+)/?$ blog.php?do=view&un=$1 [L]



All times are GMT. The time now is 06:09 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01518 seconds
  • Memory Usage 1,727KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete