41
mikeytheman
Re: Rewriting module URLs

Quote:

disky wrote:
Hi Mikey

I must admit i can't really figure out if your solution will work or not.

But i think the problem you might have is, that NewBB has a problem with the URL's being rewriten, just like Xoops'es core file did have :(

Maybe ask or search on newbb's homepage, somebody might help. Or post a new thread on this site. I have never used newbb so i am not much help there :(


Yeah, it's definately NewBB (CBB) that's the problem. I hadn't even bothered doing the others before now, just because the forums was the main concern when we started looking at mod_rewriting things and stopped dead with that. All the others work great. My next question I guess is, how do (or can) you change it from being domain.com/news/ (with the last slash) to domain.com/news (without the lash)?

42
disky
Re: Rewriting module URLs
  • 2006/1/19 8:23

  • disky

  • Just popping in

  • Posts: 90

  • Since: 2003/10/31


Hi again

Sorry for the slow answer, i have not figured out how to get xoops.org to send me an email when someone posts in this thread, so sometimes it take some time before i visit the site.

'My next question I guess is, how do (or can) you change it from being domain.com/news/ (with the last slash) to domain.com/news (without the lash)?'

This is easy :)

Instead of:
RewriteRule ^shortcut/$ /modules/veryLongUrl/index.php [L]

use:
RewriteRule ^shortcut$ /modules/veryLongUrl/index.php [L]

the first part after 'RewriteRule '^shortcut$'

Is a regular expression telling mod_rewrite the following:

^ means start of line (which is actually after the part in 'RewriteBase' from earlier in the .htaccess file)
shortcut means look for 'shortcut'
$ means end of line

So mod_rewrite looks for a line containing nothing more than 'shortcut' which with url and everything is 'http://www.mydomain.com/shortcut' where the 'http://www.mydomain.com/' is defined by '/' in the rewritebase part of the .htaccess file.

So when you have a rewrite rule like this:

RewriteRule ^shortcut/$ /modules/veryLongUrl/index.php [L]

It means a line containing 'shortcut/'

If you have:
RewriteRule ^shortcut/.*$ /modules/veryLongUrl/index.php [L]

It means a line starting with 'shortcut/' followed by anything, so these following will work
shortcut/
shortcut/blabla
shortcut/dir1/dir2/dir3/fjfjfkajdhfkljsdfhglsdfg



Hope it makeas a little bit of sence, sort of hard for me to explain (not english by nature)

If not just ask.

43
mikeytheman
Re: Rewriting module URLs

wow...that was great...thank you...i still have to figure out the cbb issue now lol

44
mikeytheman
Re: Rewriting module URLs

Heh. Okey, so i said to hell with cbb if it wasn't going to like mod_rewrite. Instead, I've gone with the x-ipb mod. What I'm curious about now is how to get the links within the module to point to the mod_rewritten location and work. I've got the basic .htaccess looking like this:
Quote:

RewriteEngine On
RewriteBase /
RewriteRule ^forum/$ /modules/ipboard/ [L]
RewriteRule ^forum$ /modules/ipboard/ [L]


But I'm wondering what I need to change to make it work for the rest of the module.

I was able to find the following in the /modules/ipboard/index.php file:
if ( $ibforums->session_type == 'cookie' )
{
    
$ibforums->session_id "";
    
$ibforums->base_url   $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext'].'?';
}
else
{
    
$ibforums->base_url $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext'].'?';
}

$ibforums->js_base_url $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext'].'?';


and realized that if i changed the $ibforums->js_base_url=$ibforums->vars['board_url'] to the location I needed, it'll somewhat work. However, it now goes to domain.com/forum/index.php?showthread=1.

What I'm wondering is, how would I modify it to have domain.com/forum/thread/1, domain.com/forum/forum/1, domain.com/forum/user/1 to suit index.php?showthread=1, index.php?showforum=1 and index.php?showuser=1 respectively.

Looking at it now, I'm thinking i'll have to change more than just the $ibforums->vars['board_url'] and probably have to figure out how to change the format of $ibforums->vars['php_ext'].

Any advice?

45
disky
Re: Rewriting module URLs
  • 2006/1/24 22:05

  • disky

  • Just popping in

  • Posts: 90

  • Since: 2003/10/31


Hi again :)

I am not sure about the changes to the forum.

But the .htaccess should be something like:

RewriteEngine On
RewriteBase /
RewriteRule ^forum/thread/([0-9]+)$ /index.php?showthread=$1 [L]
RewriteRule ^forum/forum/([0-9]+)$ /index.php?showforum=$1 [L]
RewriteRule ^forum/user/([0-9]+)$ /index.php?showuser=$1 [L]


But i guess that in front of '/index.php' you need a bit more URL to point the the correct directory of your server.

Hope it works, if not just 'complain'

46
mikeytheman
Re: Rewriting module URLs

heh. Thank you ever so much. My next question might be a little more complicated.

I was wondering how to use mod_rewrite to my advantage with wildcard dns available to me. I'm thinking of using it to provide users with their own subdomain and had heard that this was posible with wildcard dns.

47
disky
Re: Rewriting module URLs
  • 2006/1/28 23:20

  • disky

  • Just popping in

  • Posts: 90

  • Since: 2003/10/31


I am not to sure about what you mean.

So you have your *.mydomain.com and you want
site1.mydomain.com to point to one website and site2.mydomain.com to point to another website ?

If so just use virtual hosts in apache's config file.

You could have:

ServerName site1.mydomain.com
ServerAlias http://www.site1.mydomain.com site1.mydomain.com
More lines here



ServerName site2.mydomain.com
ServerAlias http://www.site2.mydomain.com site2.mydomain.com
More lines here


The serveralias just makes aliases for your site so that http://www.site1.mydomain.com is the same at site1.mydomain.com


If i miss understood your question, please explain :)

48
mikeytheman
Re: Re: Rewriting module URLs

Heh. I was actually looking at subdomain creation with php, mod_rewrite and wildcard dns. It allowed you to have subdomains that weren't really subdomains. Wait, maybe it didn't use mod_rewrite lol. I think it actually depended on the wildcard dns to allow for header information to redirect the user to the appropriate directory. Hmmm, maybe mod_rewrite was used. Anyways, the relative concept makes sense. I was just wondering how or if this was posible with xoops.

49
disky
Re: Re: Re: Rewriting module URLs
  • 2006/1/29 9:15

  • disky

  • Just popping in

  • Posts: 90

  • Since: 2003/10/31


Sorry can't help you with that one.

I am sure it is possible, but i just don't know how, sorry.

50
phppp
Re: Rewriting module URLs
  • 2006/1/29 13:51

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


disky, thank you for the amazing work!

I was told newbb/CBB is not compatible with the rewriting rules. If you have already had some look-insight and locate where the problem is, I am going to look at some solution.

At this moment I am preparing a "full-compatible" version of CBB that will work with XOOPS 2.0, 2.2 and 2.3+. I wish we can make the rewriter work with CBB before XOOPS 2.3 URL rewriter comes out.

Login

Who's Online

334 user(s) are online (270 user(s) are browsing Support Forums)


Members: 0


Guests: 334


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits