vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   fake dirs (https://vborg.vbsupport.ru/showthread.php?t=127265)

sabret00the 09-22-2006 01:20 PM

fake dirs
 
how would i go about setting up fake directories?

i.e.
http://www.ebslive.com/journals/user...me=sabret00the become www.ebslive.com/journals/sabret00the

http://www.ebslive.com/journals/user...isplay=friends becomes www.ebslive.com/journals/sabret00the/friends

http://www.ebslive.com/journals/user...y=syndications becomes http://www.ebslive.com/journals/sabr...e/syndications

nico_swd 09-22-2006 01:31 PM

With .htaccess.

Code:

RewriteEngine on
RewriteRule ^([A-Za-z0-9]+)(/)?$ user.php?username=$1
RewriteRule ^([A-Za-z0-9]+)/friends(/)?$ user.php?username=$1&display=friends
RewriteRule ^([A-Za-z0-9]+)/syndications(/)?$ user.php?username=$1&display=syndications

This should work.

sabret00the 09-22-2006 01:36 PM

Thanks Nico, i really really really appreciate that.

nico_swd 09-22-2006 01:43 PM

No problem. You might want to add an underscore to the pattern if these are allowed in usernames.

Code:

-_A-Za-z0-9
Otherwise if it would fail if someone had a username like nico_swd, lol.

SaN-DeeP 09-22-2006 03:53 PM

how would you take care of special characters and/or other language chars via .hta ?

thanks.

nico_swd 09-22-2006 03:59 PM

I don't think I understand what you're trying to do.

sabret00the 09-22-2006 04:29 PM

Nico, one more question, say if i have
http://www.ebslive.com/journals/user...et00the&e=5329
http://www.ebslive.com/journals/user...et00the&e=5330
http://www.ebslive.com/journals/user...et00the&e=5331

and i want to change that into

http://www.ebslive.com/journals/sabret00the/e=5329
http://www.ebslive.com/journals/sabret00the/e=5330
http://www.ebslive.com/journals/sabret00the/e=5331
what would i do then?

RewriteRule ^([A-Za-z0-9]+) e=$2 (/)?$ user.php?username=$1&e=$2

nico_swd 09-22-2006 06:02 PM

Give this a try.
Code:

RewriteRule ^([A-Za-z0-9]+)/e=([0-9]+)$ user.php?username=$1&e=$2
EDIT:

You could take out the e= as well. This should do it.
Code:

RewriteRule ^([A-Za-z0-9]+)/([0-9]+)$ user.php?username=$1&e=$2

Antivirus 09-23-2006 01:55 AM

very interesting. I can imagine the value for this in increasing security. Thanks!

nico_swd 09-23-2006 05:15 AM

Not only security. Google will love it too. :D

sabret00the 09-23-2006 07:14 AM

thanks nico :)

nico_swd 09-23-2006 08:17 AM

I've checked your site a bit, and there are some users with weird usernames that could cause errors. This here should work with most of them.
Code:

RewriteEngine on
RewriteRule ^(.*)/$ user.php?username=$1
RewriteRule ^(.*)/friends(/)?$ user.php?username=$1&display=friends
RewriteRule ^(.*)/syndications(/)?$ user.php?username=$1&display=syndications
RewriteRule ^(.*)/([0-9]+)$ user.php?username=$1&e=$2

It would be easier and safer if you could use the userids instead of the usernames. If a user has for example a * in his username it will cause an error, and I'm not sure if there's a way around that.

The code above also requires a slash at the end when calling /journals/sabret00the/. I couldn't get it to work without.

sabret00the 09-23-2006 09:34 AM

Quote:

Originally Posted by nico_swd
I've checked your site a bit, and there are some users with weird usernames that could cause errors. This here should work with most of them.
Code:

RewriteEngine on
RewriteRule ^(.*)/$ user.php?username=$1
RewriteRule ^(.*)/friends(/)?$ user.php?username=$1&display=friends
RewriteRule ^(.*)/syndications(/)?$ user.php?username=$1&display=syndications
RewriteRule ^(.*)/([0-9]+)$ user.php?username=$1&e=$2

It would be easier and safer if you could use the userids instead of the usernames. If a user has for example a * in his username it will cause an error, and I'm not sure if there's a way around that.

The code above also requires a slash at the end when calling /journals/sabret00the/. I couldn't get it to work without.

what i'll do is, i'll get users to change their usernames, it seems the best bet. thanks for your help, i really appreciate that.

nico_swd 09-23-2006 10:04 AM

What you can do is following to avoid new users with bad characters.

Go to.

Admincp -> vbulletin options -> User registration options -> Username Regular Expression

And enter this: ^[-_A-Za-z0-9]+$

This way users can't pick bad characters and you don't have to worry about it in the future.


All times are GMT. The time now is 07:19 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.01533 seconds
  • Memory Usage 1,746KB
  • 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
  • (6)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (14)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete