Jump to content

PHP GET and Apache 2's Rewrite Module.


Otosareta Tenshi
 Share

Recommended Posts

I seriously need some help with this issue. I've got a website at the root of the domain "http://www.domain.com". I'm working on a beta version of the website at "http://www.domain.com/beta/", and I have a .htaccess file in the beta folder. In this folder, I have the following:

RewriteEngine	OnRewriteCond %{REQUEST_FILENAME} !skins [NC]RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?cat=$1&pg=$2&subpg=$3 [L]RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?cat=$1&pg=$2[L]RewriteRule ^([^/\.]+)/?$ /index.php?cat=$1 [L]

I want it to rewrite anything like "beta/games/", "beta/games/gamename/", or "beta/game/gamename/stats/" to "beta/index.php?&cat=games", "beta/index.php?&cat=games&pg=gamename", or "beta/index.php?&cat=games&pg=gamename&subpg=stats" respectively. With the above rules, the main index.php works, but any of the pages that are supposed to redirect, don't. I have also tried the following:

RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !skins [NC]RewriteRule ^([^/]+)(/)?([^/]*)?(/)?([^/]*)?(/)? index.php?cat=$1&pg=$3&subpg=$5 [NC,L]

But this only resulted in $cat being set to index.php.I am at a loss here, and I need some precise advice. Thanks in advance.

Edited by Otosareta Tenshi
Link to comment
Share on other sites

I think RewriteBase (http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritebase) may help.Also - you can use the base tag in your HTML: http://www.w3schools.com/tags/tag_base.asphttp://httpd.apache.org/docs/2.2/rewrite/rewrite_guide.htmlAnother option, which might be easier would be to run a subdomain and set DocumentRoot to the demo directory.Then, you wouldn't have to change any of the RewriteRules or the configuration and you could just copy it out when you're ready to launch.

Edited by wirehopper
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...