Jump to content
Larry Ullman's Book Forums

Chapter 2 Modularizing A Web Site


Recommended Posts

xampp / php 5.3

 

I've used the chapter 2 "Modularizing a web site" and it works like a charm.

 

However I was wanting to use htaccess to turn 'http://localhost/website/index.php?p=about' into 'http://localhost/website/about'.

 

I can't get it to work here but I have used this simple htaccess before and it works fine on another website I have and for other files on my localhost.

 

RewriteEngine On

RewriteRule ^([a-zA-Z0-9]+)$ index.php?p=$1

RewriteRule ^([a-zA-Z0-9]+)/$ index.php?p=$1

 

with the htaccess placed in the same directory as index.php and p is the same p in the example on page 62 or 64.

 

Does anyone know what I can do to get this to work, from the things I've read it should produce the url I need.

 

Thanks for any help

S

Link to comment
Share on other sites

Thanks Johnathon

 

I tried

 

RewriteEngine On

RewriteRule ^([a-zA-Z0-9]+)ed/5advan/chp2work$ index.php?p=$1

RewriteRule ^([a-zA-Z0-9]+)ed/5advan/chp2work/$ index.php?p=$1

 

RewriteEngine On

RewriteRule ^([a-zA-Z0-9]+)/ed/5advan/chp2work$ index.php?p=$1

RewriteRule ^([a-zA-Z0-9]+)/ed/5advan/chp2work/$ index.php?p=$1

 

With no luck.

 

If someone has done this exercise can they give it a try on the standard chapter 2 download, that's what I'm using, if it works on their computer I'll know its me.

 

Thanks

SJ

Link to comment
Share on other sites

  • 2 months later...

Okay here is my "Duh report", it's had been about three months since I messed with this and I decided I'd try again today and of course it worked when I saw what I had done.

 

Larry has <li><a href="index.php?p=that">That</a></li> in the menu and three months ago I had left it like that while I looked for the problem. Today when I changed the link to <li><a href="that">That</a></li> it worked like a charm.

 

So the htaccess would have worked all along, anyway thanks for the help.

Link to comment
Share on other sites

 Share

×
×
  • Create New...