Jump to content

Recommended Posts

I own a games wbesite called gpstudios.com

I want to make it so that instead of loading pages with .php?id=xxx, they load with /id

 

This is what I've tried so far:

 

RewriteEngine on

RewriteRule ^play/([0-9]+) playgame.php?gameid=$1

 

I want to change playgame.php?gameid=200 to play/200

But if I type http://www.gpstudios.com/play/200 I get a white page, with only the ads displaying correctly. No other images are loading.

Also, I thought through this technique it would work both ways, but when I type in http://www.gpstudios.com/playgame.php?gameid=200 and load the page, the address doesn't change. How do I make it so that the address converts http://www.gpstudios.com/playgame.php?gameid=200 into http://www.gpstudios.com/play/200 ???

 

Help, please.

Link to comment
https://forums.phpfreaks.com/topic/215292-rewriterule-not-working/
Share on other sites

There doesn't appear to be a problem with the rewrite rule, but you're using relative paths to your external JavaScripts and stylesheets. For example:

 

<link href="style.css" rel="stylesheet" type="text/css" />

 

The browser will try to find the stylesheet relative from the current URL, effectively "play/200/style.css". You need to use an 'absolute' path that doesn't need to change in any directory... For example:

 

<link href="/style.css" rel="stylesheet" type="text/css" />

 

That will look for "style.css" within the document root.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.