[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

Mod Rewrite Problem

does anybody have any idea why mod rewrite would rewrite a url and show up blank page where by the page itself is not blank.

for example: i have pages.php?id=45 to be rewritten as pages/45.

that would go on and show me a blank page, but when i access it as pages.php?id=45 it gives me the normal result

pls help urgently
0
xavier45
Asked:
xavier45
  • 9
  • 8
  • 2
  • +1
3 Solutions
 
giltjrCommented:
Do you want to post your rewrite rules?
0
 
xavier45Author Commented:
oh yeah, here it is

RewriteRule ^entry/([0-9]+)$ entry.php?id=$1 [L]
0
 
giltjrCommented:
try

     RewriteRule pages/(.*)/(.*)$ /pages.php?$1=$2
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
xavier45Author Commented:
thanks but i'm still getting the same result
0
 
giltjrCommented:
O.K, just to make sure if I enter:

    http://yourhostname.yourdomainname.tdl/pages/45

I will see the correct page?
0
 
xavier45Author Commented:
i'm running this on my local machine

http://localhost/m_box/pages/45
0
 
xavier45Author Commented:
i.e if i enter http://localhost/m_box/pages/45 in the address bar i get a blank page but if i enter http://localhost/m_box/pages.php?id=45 i get the normal results(as in results related to page 45) not a blank page
0
 
giltjrCommented:
O.K.  is 45 supposed to be a directory?  Do you have the directory /page/45 and in that directory do you have index.html, or some other default page?

Do you really mean that you want somebody to enter http://localhost/m_box/pages/45 have have it re-written as http://localhost/m_box/pages.php?45


0
 
xavier45Author Commented:
no its not a directory its just a query to the db(i.e querying the db with id 45)

>>Do you really mean that you want somebody to enter http://localhost/m_box/pages/45 have have it re-written as http://localhost/m_box/pages.php?45

yes but instead of showing the exact page i get a blank page
0
 
sinisterfrogCommented:
how about

RewriteRule pages/(.*) /pages.php?id=$1

?
0
 
giltjrCommented:
http://www.webmaster-toolkit.com/mod_rewrite-rewriterule-generator.shtml

It came up with:

     RewriteRule pages/(.*)/(.*)/$ /m_box/pages.php?$1=$2

based on the user entering:

     http://localhost/m_box/pages/45

and you wanting:

     http://localhost/m_box/pages.php?45
0
 
xavier45Author Commented:
thanks but i'm still getting blank pages
0
 
sinisterfrogCommented:
make a new pages.php that echos the $id value.... maybe it's a problem with ur php code...
0
 
caterham_wwwCommented:
blank page=completly white? That sounds like the PHP bug.

Does
RewriteRule ^a /b.html [L]

work (rewriting to non-php files)?
0
 
xavier45Author Commented:
>>make a new pages.php that echos the $id value.... maybe it's a problem with ur php code...
no my code is fine as i said in my question "when i access the page as pages.php?id=45, it woeks fine, as in i get what i expected(results related to 45)"

>>blank page=completly white? That sounds like the PHP bug.
Yes

>>Does
RewriteRule ^a /b.html [L]

work (rewriting to non-php files)?

yes it does
0
 
giltjrCommented:
If you use your browsers "view source" option, what HTML code shows?

I agree with sinisterfrog, make a new pages.php script but instead of just echoing id, I would echo the whole URL that it is invoked with.  If the rewrite is working, then you can see what it is doing.  However if the rewrite is not working I would expect you to get some error page and not just a blank page.

0
 
xavier45Author Commented:
>>However if the rewrite is not working I would expect you to get some error page and not just a blank page.

thats what i'm saying if there's a problem i should be getting an error page and not just a blank page
however if i sometimes mess up with the .htaccess syntax(you know just to see if i'd get an error page) i get an error page so i don't think this has to do with an error.

what the problem is, i just don't know
0
 
giltjrCommented:
Do you see anything in the Apache logs?
0
 
caterham_wwwCommented:
0
 
xavier45Author Commented:
what do you advice that i do now?
0
 
giltjrCommented:
It appears that this is fixed in the latest releases of V4 and V5.  Install the most recent levels of what ever version you are running?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 8
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now