Understanding htaccess

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
puertoblack2003
-


Joined: 08 Oct 2006
Posts: 87

PostPosted: Wed Oct 25, 2006 9:29 pm    Post subject: Understanding htaccess Reply with quote

good day and love the program.Now i'm new to this kind of thing but a fast learner so please be kind :).

i have pretty much have everything configured as needed and i'm running my vbulletin site thanks to abyss no more server cost but my own..lol but to the point.

i seem to have problem with the htaccess file on my windows xp pro computer i've been reading and reading and all i got so far is a headache i have a arcade system that was previuosly on a linux server (hosting Company) and now it's on my home computer everything is up and running but for some reason it's not directing to the games to play .Now in the arcade files it has a htaccess that direct to to the games when i click on the game it takes me to a 404 error no page found can anybody assist me on this please my members are missing it and will like to get this going.

Program Info:

game script version 2

htaccess file info:

Code:
DirectoryIndex index.php
RewriteEngine on
RewriteRule ^play-([0-9]+) index.php?action=play&id=$1 [L]
RewriteRule ^cat-([0-9]+)?-p([0-9]+) index.php?action=category&id=$1&page=$2&order2=game_name&sby=ASC [L]
RewriteRule ^cat-([0-9]+) index.php?action=category&id=$1&ppage=20&order2=game_name&sby=ASC [L]
RewriteRule ^profile-(.*)\.html$ /index.php?page=viewprofile&user=$1 [L]
RewriteRule ^page-(.*)$ index.php?page=$1 [L] 
Options -Indexes


thank you
Back to top View user's profile Send private message
puertoblack2003
-


Joined: 08 Oct 2006
Posts: 87

PostPosted: Wed Oct 25, 2006 9:30 pm    Post subject: Re: Understanding htaccess Reply with quote

puertoblack2003 wrote:
good day and love the program.Now i'm new to this kind of thing but a fast learner so please be kind :).

i have pretty much have everything configured as needed and i'm running my vbulletin site thanks to abyss no more server cost but my own..lol but to the point.

i seem to have problem with the htaccess file on my windows xp pro computer i've been reading and reading and all i got so far is a headache i have a arcade system that was previuosly on a linux server (hosting Company) and now it's on my home computer everything is up and running but for some reason it's not directing to the games to play .Now in the arcade files it has a htaccess that direct to to the games when i click on the game it takes me to a 404 error no page found can anybody assist me on this please my members are missing it and will like to get this going.

Program Info:

game script version 3

htaccess file info:

Code:
DirectoryIndex index.php
RewriteEngine on
RewriteRule ^play-([0-9]+) index.php?action=play&id=$1 [L]
RewriteRule ^cat-([0-9]+)?-p([0-9]+) index.php?action=category&id=$1&page=$2&order2=game_name&sby=ASC [L]
RewriteRule ^cat-([0-9]+) index.php?action=category&id=$1&ppage=20&order2=game_name&sby=ASC [L]
RewriteRule ^profile-(.*)\.html$ /index.php?page=viewprofile&user=$1 [L]
RewriteRule ^page-(.*)$ index.php?page=$1 [L] 
Options -Indexes


thank you
Back to top View user's profile Send private message
Mikor
-


Joined: 21 Aug 2006
Posts: 144
Location: Hull, England

PostPosted: Wed Oct 25, 2006 10:18 pm    Post subject: Reply with quote

Abyss dosnt suppost .htaccess, its an Apache-Only thing.
_________________
Yarrt.com - Free Arcade
RypNet.co.uk - Online Game

MSN:
michael_walker_2004 <at> hotmail <dot> com
Back to top View user's profile Send private message Send e-mail MSN Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Wed Oct 25, 2006 10:24 pm    Post subject: Reply with quote

All you need is the URL Rewriting feature, but unfortunately it's not ready as of
yet. The good news is that they're working on it now. You can configure a simple
PHP script to create a workaround for now.

URL Rewriting - Hack
http://www.aprelium.com/forum/viewtopic.php?t=7865
Back to top View user's profile Send private message Visit poster's website
puertoblack2003
-


Joined: 08 Oct 2006
Posts: 87

PostPosted: Wed Oct 25, 2006 10:35 pm    Post subject: Reply with quote

TRUSTAbyss wrote:
All you need is the URL Rewriting feature, but unfortunately it's not ready as of
yet. The good news is that they're working on it now. You can configure a simple
PHP script to create a workaround for now.

URL Rewriting - Hack
http://www.aprelium.com/forum/viewtopic.php?t=7865


i tried to set it up that way but was getting stuck and could not get it work.I mean it stopped the 404 error page but it will not redirect to the game part so the member can play it's redirecting back to home page. :?
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Wed Oct 25, 2006 10:42 pm    Post subject: Reply with quote

I edited the script for you. Tell me if it works.

Code:
<?php

/* Add in this array the list of (old path => new path) pairs */
$redirection = array(
   '^play-([0-9]+)' => 'index.php?action=play&id=$1',
   '^cat-([0-9]+)?-p([0-9]+)' => 'index.php?action=category&id=$1&page=$2&order2=game_name&sby=ASC',
   '^cat-([0-9]+)' => 'index.php?action=category&id=$1&ppage=20&order2=game_name&sby=ASC',
   '^profile-(.*)\.html$' => '/index.php?page=viewprofile&user=$1',
   '^page-(.*)$' => 'index.php?page=$1'
);

/* Get the URI and trim leading slashes */
$uri = ltrim($_SERVER["REDIRECT_SCRIPT_NAME"], "/");

foreach ($redirection as $key => $value)
{
   if (eregi($key, $uri))
   {
        /* Convert the replacement string syntax - $1 -> \1 */
        /* and perform the substitution */
      $new_uri = eregi_replace($key, str_replace("$", "\\", $value), $uri);
      break;
   }
}

if (isset($new_uri))
{
   header("Status: 307");
   header("Location: $new_uri");
   exit;
}

?>

<!-- Your 404 error page -->

<HTML>
<HEAD>
<TITLE>
Not Found
</TITLE>
</HEAD>
<BODY>
The object <tt><?php echo $uri; ?></tt> is not available.
</BODY>
</HTML>
Back to top View user's profile Send private message Visit poster's website
puertoblack2003
-


Joined: 08 Oct 2006
Posts: 87

PostPosted: Wed Oct 25, 2006 10:59 pm    Post subject: Reply with quote

TRUSTAbyss wrote:
I edited the script for you. Tell me if it works.

Code:
<?php

/* Add in this array the list of (old path => new path) pairs */
$redirection = array(
   '^play-([0-9]+)' => 'index.php?action=play&id=$1',
   '^cat-([0-9]+)?-p([0-9]+)' => 'index.php?action=category&id=$1&page=$2&order2=game_name&sby=ASC',
   '^cat-([0-9]+)' => 'index.php?action=category&id=$1&ppage=20&order2=game_name&sby=ASC',
   '^profile-(.*)\.html$' => '/index.php?page=viewprofile&user=$1',
   '^page-(.*)$' => 'index.php?page=$1'
);

/* Get the URI and trim leading slashes */
$uri = ltrim($_SERVER["REDIRECT_SCRIPT_NAME"], "/");

foreach ($redirection as $key => $value)
{
   if (eregi($key, $uri))
   {
        /* Convert the replacement string syntax - $1 -> \1 */
        /* and perform the substitution */
      $new_uri = eregi_replace($key, str_replace("$", "\\", $value), $uri);
      break;
   }
}

if (isset($new_uri))
{
   header("Status: 307");
   header("Location: $new_uri");
   exit;
}

?>

<!-- Your 404 error page -->

<HTML>
<HEAD>
<TITLE>
Not Found
</TITLE>
</HEAD>
<BODY>
The object <tt><?php echo $uri; ?></tt> is not available.
</BODY>
</HTML>


ok i put the script shown here it now redriected me to the 404 page

forgot to mention i have it's in a folder like yourstite.com/arcade would that be a problem

edit; ok forgot to refresh this is what it's giving me The object
Code:
arcade/play-20718-Super_Mario_Time_Attack_Remix.html is not available.


and i'm sure that game is in the folder
Back to top View user's profile Send private message
puertoblack2003
-


Joined: 08 Oct 2006
Posts: 87

PostPosted: Wed Oct 25, 2006 11:42 pm    Post subject: Reply with quote

hey guys i think i got it :lol: apparently from my original host since they use linux i didn't have problem creating a sub folder arcade .and that was fine .So what i did is when i seen that message that i posted above this here soimething told me to open the folder to public_htmll with no sub folder and now is working i'm able to when you click on the game it' will take me there...lol..now it;s cool.

thanks guys for ya help.you guys rock and look forward to the new version for htaccess...
Back to top View user's profile Send private message
puertoblack2003
-


Joined: 08 Oct 2006
Posts: 87

PostPosted: Thu Oct 26, 2006 9:07 pm    Post subject: Reply with quote

good day every time there seem to be an obstacle when i thought i have everything fine.

ok i copied the way you have set up for the first arcade system and that went well when i tried to imitate the same way written it didn't work for the other game script can you see what i did wrong please.

htaccess:
Code:
RewriteEngine On
#turn on the Rewrite engine, if it's not already active

#set the base directory to /
RewriteBase /

# now the rewriting rules
RewriteRule ^games/ games.php [L]

# now the rewriting rules
RewriteRule ^game/ game.php [L]




rewritten code:
Code:
<?php

/* Add in this array the list of (old path => new path) pairs */
$redirection = array(
   '^games/ games.php [L]',
 ' ^game/ game.php'
);

/* Get the URI and trim leading slashes */
$uri = ltrim($_SERVER["REDIRECT_SCRIPT_NAME"], "/");

foreach ($redirection as $key => $value)
{
   if (eregi($key, $uri))
   {
        /* Convert the replacement string syntax - $1 -> \1 */
        /* and perform the substitution */
      $new_uri = eregi_replace($key, str_replace("$", "\\", $value), $uri);
      break;
   }
}

if (isset($new_uri))
{
   header("Status: 307");
   header("Location: $new_uri");
   exit;
}

?>

<!-- Your 404 error page -->

<HTML>
<HEAD>
<TITLE>
Not Found
</TITLE>
</HEAD>
<BODY>
The object <tt><?php echo $uri; ?></tt> is not available.
</BODY>
</HTML>



Can you please check to see if this correct.Thanks guys for your time
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Thu Oct 26, 2006 10:06 pm    Post subject: Reply with quote

The first key element in your array has an Apache Flag. This makes the regular
expression false and returns the 404 error instead.

To fix this, simply remove the Apache Flag "[L]"
Back to top View user's profile Send private message Visit poster's website
puertoblack2003
-


Joined: 08 Oct 2006
Posts: 87

PostPosted: Thu Oct 26, 2006 11:39 pm    Post subject: Reply with quote

TRUSTAbyss wrote:
The first key element in your array has an Apache Flag. This makes the regular
expression false and returns the 404 error instead.

To fix this, simply remove the Apache Flag "[L]"


you know i'm trying very hard to get that to work but did not have any success it was taking me to a no page found. with that configuration.any idea's?
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Oct 27, 2006 12:40 am    Post subject: Reply with quote

OK, now I see the TRUE error. You setup the Rewrite Rules wrong. You should
seperate the RewriteRule like this.

Note: The Regular Expression is "^games/" and the Substitute is "games.php"

Example: '^games/' => 'games.php'

Code:
$redirection = array('^games/' => 'games.php',
                     '^game/' => 'game.php');


Last edited by TRUSTAbyss on Fri Oct 27, 2006 12:52 am; edited 5 times in total
Back to top View user's profile Send private message Visit poster's website
puertoblack2003
-


Joined: 08 Oct 2006
Posts: 87

PostPosted: Fri Oct 27, 2006 12:45 am    Post subject: Reply with quote

TRUSTAbyss wrote:
Do you have the directory "game" and "games" in your htdocs folder?


yes but the way the games are all in flashfiles and inside the flashfiles are the games and game.And also outside the flashfile are 2 empty files game and games which had confused me and that's how it's configured.
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Oct 27, 2006 12:46 am    Post subject: Reply with quote

I edited my post, please read.
Back to top View user's profile Send private message Visit poster's website
puertoblack2003
-


Joined: 08 Oct 2006
Posts: 87

PostPosted: Fri Oct 27, 2006 12:56 am    Post subject: Reply with quote

i guess we are getting there this the error i received

Code:
The page isn't redirecting properly

     

     
     
     

     
       
       

         

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

       


       
       


    *   This problem can sometimes be caused by disabling or refusing to accept
          cookies.




     


     
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Oct 27, 2006 12:59 am    Post subject: Reply with quote

Try this:

Change /path/to/ with the path to the file.

Code:
$redirection = array('^games/' => '/path/to/games.php',
                     '^game/' => '/path/to/game.php');
Back to top View user's profile Send private message Visit poster's website
puertoblack2003
-


Joined: 08 Oct 2006
Posts: 87

PostPosted: Fri Oct 27, 2006 1:05 am    Post subject: Reply with quote

TRUSTAbyss wrote:
Try this:

Change /path/to/ with the path to the file.

Code:
$redirection = array('^games/' => '/path/to/games.php',
                     '^game/' => '/path/to/game.php');


error:
Code:
The object game.phpgem-mania is not available.
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group