1
studioC
quick .htaccess question
  • 2005/8/8 8:43

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


hello xoopser .. just a quick question:

i made a small tiny "module" and url to it is:

http://xoopxxsrxxoot.tld/modules/mymod/?form_id=1


now i want to use mod_rewrite for only this url to be displayed as

http://xoopxxsrxxoot.tld/myformular.php



any hints for stupid me what to put in .htaccess?

michael

2
skalpa
Re: quick .htaccess question
  • 2005/8/8 9:10

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


Put this in the .htaccess that is in the root of your site (or create it if necessary):
RewriteRule ^formular.php$     /modules/mymod/index.php?form_id=1   [QSA]


You may or may not want to let the [QSA] part...
Without:
formular.php?thing=stuff => index.php?form_id=1
With:
formular.php?thing=stuff => index.php?form_id=1&thing=stuff

skalpa.>
Any intelligent fool can make things bigger, and more complex. It takes a touch of genius, a lot of courage, to move in the opposite direction.
Two things are infinite: the universe and human stupidity; and I'm not sure about the 1st one (A.Einstein)

3
studioC
Re: quick .htaccess question
  • 2005/8/8 9:20

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


thanks skalpa

this is what i did:

RewriteRule ^answerformular\.php$ /modules/liaise/?form_id=2


http://xoopsfactory.com/answerformular.php

but get the f..ckng answer that selected modul does not exist.

but sure it exist and is accessible for all

michael

4
studioC
Re: quick .htaccess question
  • 2005/8/8 9:51

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


..hm ... edited for it wasn't correct ...

sorry ... selectted modul does not xis..t

michael

5
phppp
Re: quick .htaccess question
  • 2005/8/8 11:21

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


Make sure rewrite mod is enabled

6
studioC
Re: quick .htaccess question
  • 2005/8/8 12:15

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


rewrite mod is enabled and in action to eg. set a standardomain and errodocument.

when i add path to modul
RewriteRule ^modules/mymod/formular\.php$ /modules/mymod/?form_id=1 [QSA]

it works but then i have the pathhttp://domain.tld/modules/mymod/formular.php

..hm ...

7
Mithrandir
Re: quick .htaccess question

since XOOPS checks access to a module page from the module dirname that is calculated from the URL.

At work, we had to make an environment-specific specification to ensure the contents of the $_SERVER['REQUEST_URI'] variable being correct as in showing the name of the accessed URL and not just the one shown in the browser's address bar.
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

8
studioC
Re: quick .htaccess question
  • 2005/8/8 13:54

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


thanks for this hint jan ... i thought about it and i think i can live with the path to modul and with only rewriting the ?form_id=1

again
thanks to all

btw. nice to see ya back from holiday

9
skalpa
Re: quick .htaccess question
  • 2005/8/8 15:12

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


Quote:
i think i can live with the path to modul and with only rewriting the ?form_id=1


lol. One bit of code I have patched for more than 2 years and that is not in CVS yet.

Just one line to change (but the file changed between 2.0.13 and 2.2).
With a 2.0.x core:
in include/common.phpfind
    
if (file_exists('./xoops_version.php')) {
        
$url_arr explode('/',strstr($xoopsRequestUri,'/modules/'));
        
$module_handler =& xoops_gethandler('module');

and 
replace $xoopsRequestUri with  $_SERVER['PHP_SELF']


With 2.2.x:
in kernel/module.php (at the end of the file)
        
$url_arr explode('/',strstr($GLOBALS['xoopsRequestUri'],'/modules/'));

in that onereplace $GLOBALS['xoopsRequestUri'with $_SERVER['PHP_SELF']


and this will make your XOOPS a lot more mod_rewrite friendly
skalpa.>
PS: I'm writing this without testing, so take care, but it should be it
PS2: That will be in the next one, promised
Any intelligent fool can make things bigger, and more complex. It takes a touch of genius, a lot of courage, to move in the opposite direction.
Two things are infinite: the universe and human stupidity; and I'm not sure about the 1st one (A.Einstein)

10
studioC
Re: quick .htaccess question
  • 2005/8/8 15:34

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


:kiss

thanks skalpa, that worked
michael

Login

Who's Online

78 user(s) are online (56 user(s) are browsing Support Forums)


Members: 0


Guests: 78


more...

Donat-O-Meter

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

Latest GitHub Commits