logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 11-06-2013, 08:14 AM   #1
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default mod_rewrite

I have backed my self up a tree here. I have a script that is failing as it cannot detect if mod_rewrite is installed. It is not a uniqque problem it seems , but i have a test but cannot adapt it for a sub folder , the following is a test for the root directory. can any one see the error , or rather whare i must change the path for a folder??

.htaccess
Code:
<IfModule mod_rewrite.c>

    # Tell PHP that the mod_rewrite module is ENABLED.
    SetEnv HTTP_MOD_REWRITE On

    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) index.php?q=$1

</IfModule>

and index.php

Code:
<?php
// Print the value of the "q" parameters so we can compare it in our test function below.
echo "Current URL: " . $_GET['q'] . "<br/>\n";

// Prevent infinite loops by checking if this request is done by our function
if ($_GET['q'] != 'test_mod_rewrite') {
  if (is_mod_rewrite_enabled()) {
    print "The apache module mod_rewrite is enabled.<br/>\n";
  } else {
    print "The apache module mod_rewrite is NOT enabled.<br/>\n";
  }
}

/**
 * Verifies if the mod_rewrite module is enabled by calling itself in
 * a way that will trigger the mod_rewrite rules.
 * This only works if you have an .htaccess file in the same folder
 * and if the rule will redirect anything to ?q=$1
 *
 * @return boolean True if the module is enabled.
 */
function is_mod_rewrite_enabled() {

// here failed

  $content = file_get_contents("http://" . $_SERVER['HTTP_HOST'] . "/test_mod_rewrite");

// here failed




  if ($content == "Current URL: test_mod_rewrite<br/>\n") {
    return TRUE;
  } else {
    return FALSE;
  }
}
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 11-07-2013, 05:37 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

got that , it was the path. Bloody script will not install though grrrr!!
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:02 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com