Author |
Message |
hitwalker
Sells PC To Pay For Divorce

Joined:
Posts: 5661
|
Posted:
Sat May 28, 2005 9:52 am |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Sat May 28, 2005 11:50 am |
|
I still use the original GT so I will respond with that. In header.php you would haveCode:function replace_for_mod_rewrite(&$s) {
$urlin = array("'(?<!/)modules.php\?name=Downloads'");
$urlout = array("downloads.html");
$s = @preg_replace($urlin, $urlout, $s);
return $s;
}
|
Then the .htaccess would beCode:RewriteRule ^downloads.html downloads.html [L]
|
|
Last edited by Raven on Sat May 28, 2005 12:51 pm; edited 2 times in total |
|
|
 |
hitwalker

|
Posted:
Sat May 28, 2005 12:18 pm |
|
ah okay,but where should the header part be put?
cause different positions turns site into blank.. |
|
|
|
 |
Raven

|
Posted:
Sat May 28, 2005 12:50 pm |
|
I just noticed a typo in my other post - sorry.Code:$urlout = array("'"downloads.html"'");
should be
$urlout = array("downloads.html");
|
I have fixed it. Does that solve your problem or do you need the full GT code for your site? |
|
|
|
 |
hitwalker

|
Posted:
Sat May 28, 2005 12:58 pm |
|
well raven,weird thing is..
i took that "original"?..stuff from that gt next gen site...(version 2003 ?) and installed it by the letter..
but then i got on all modules ...you cannot access this directly common error...
was easy install but test site went dead...
and therefore unable to see if it all works.... |
|
|
|
 |
Raven

|
Posted:
Sat May 28, 2005 1:00 pm |
|
I assumed that you were already using GT and could just modify your statements to accommodate those - sorry
In header.php you probably have code similar toCode:if (eregi("header.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
require_once("mainfile.php");
|
Modify it to readCode:if (eregi("header.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
ob_start();
function replace_for_mod_rewrite(&$s) {
$urlin = array("'(?<!/)modules.php\?name=Downloads'");
$urlout = array("downloads.html");
$s = @preg_replace($urlin, $urlout, $s);
return $s;
}
require_once("mainfile.php");
|
Then in footer.php insert this code after function foot();Code:$contents = ob_get_contents(); // store buffer in $contents
ob_end_clean(); // delete output buffer and stop buffering
echo replace_for_mod_rewrite($contents); //display modified buffer to screen
|
|
|
|
|
 |
hitwalker

|
Posted:
Sat May 28, 2005 1:07 pm |
|
So do i understand this correctly?
can a simple rewrite be used with nuke without installing a full GT ? |
|
|
|
 |
Raven

|
Posted:
Sat May 28, 2005 1:11 pm |
|
I gave you all the code you need to rewrite and GT that. You don't need anything else. What exactly are you wanting to do? |
|
|
|
 |
hitwalker

|
Posted:
Sat May 28, 2005 1:20 pm |
|
well i was reading some stuff on rewrite yesterday and got caught by the idea and started trying...
but i got stuck on the usual stuff people use and that didnt worked...
and what i want?
I just wanna see how it goes if i just change one url...like the one posted of the downloads,so to let it end as .html |
|
|
|
 |
Raven

|
Posted:
Sat May 28, 2005 1:33 pm |
|
But unless you have code in nuke to translate that back to what nuke uses it does no good. See what I mean? You can haveCode:RewriteRule ^modules.php?name=Whatever Whatever.html [L]
| and that will rewrite the url but nuke won't know what to do with it unless you have a file called Whatever.html. |
|
|
|
 |
hitwalker

|
Posted:
Sat May 28, 2005 1:40 pm |
|
Yes i see,so the piece you posted above would be enough? |
|
|
|
 |
hitwalker

|
Posted:
Sat May 28, 2005 1:58 pm |
|
ok...used the posted part and that works..
so now the tricky part...
using it for more mods does it simply means..duplicate the...
Code:
$urlin = array("'(?<!/)modules.php\?name=Downloads'");
$urlout = array("downloads.html");
|
? |
|
|
|
 |
Raven

|
Posted:
Sat May 28, 2005 11:48 pm |
|
Yes, but there's much, much more if you start passing data through the url - Better read up on mod_rewrite  |
|
|
|
 |
hitwalker

|
Posted:
Sun May 29, 2005 10:18 am |
|
yeah i know,thanks raven.... |
|
|
|
 |
|