| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Senior Member
Join Date: Aug 2008
Posts: 109
|
mod_rewrite problems
Howdy. I'm having some mod_rewrite problems. I'm trying to make my company's site URL friendly. In doing so, I want each page to be http://site.com/page/ The problem isn't getting the site to do that, the problem is with my PHP scripting. Code:
Now, that in and of itself is a great error detection setting. However, when mixed with this .htaccess file: Code:
I get problems accessing folders. Like for example, I want to get to http://site.com/proof/ it brings me to index.php. How should I get around this? |
|
|
|
|
|
#2 (permalink) | |
|
Design Destroyer
Join Date: Aug 2008
Location: Somewhere in Universe
Posts: 198
|
Hi, make sure first if you don't have a page named "proof" in your php or db ... following code should work for you Code:
This will work for as static pages, example /mypage.html or /mypage but problems would be /mypage/ (at least on my server ...) Hope this helps Quote:
Code:
SIGNATURE ?
|
|
|
|
|
#3 (permalink) |
|
Shun the non-believer
|
Code:
Code:
Basically it says that there could be a '/' appearing between 0 and 1 times (meaning that it may or may not be there). - Mike |
|
|
|
#4 (permalink) |
|
Senior Member
Join Date: Aug 2008
Posts: 109
|
That's cool. But then what happens if I have http://site.com/proof/ And that directory has it's own index.php file? The mod_rewrite will only tell the server(?) that there is no proof.php file in /content/ so go to the homepage. Not that there is a /proof/ folder with it's own junk inside of it. |
|
|
|
#5 (permalink) |
|
Design Destroyer
Join Date: Aug 2008
Location: Somewhere in Universe
Posts: 198
|
Hmm Code:
I tried on my server and the problem was same, I could not reach my existing directory. So the reg-ex must be changed ... I'm not sure which one would work right. But I'm sure the problem is the reg-ex, I can't spot it. SIGNATURE ?
Last edited by feha : 07-09-2008 at 15:58. |
|
|
|
#6 (permalink) |
|
Design Destroyer
Join Date: Aug 2008
Location: Somewhere in Universe
Posts: 198
|
Code:
SIGNATURE ?
|
|
|
|
#7 (permalink) |
|
Design Destroyer
Join Date: Aug 2008
Location: Somewhere in Universe
Posts: 198
|
I have tested this solution: Code:
This works well and finds a real directory if there is one ... The problem is it works only with trailing slash ... domain.com/page/ but not domain.com/page must adjust the rule ... SIGNATURE ?
|
|
|
|
#10 (permalink) | |
|
Shun the non-believer
|
Quote:
In this example, it would match the string whether a forward slash is present (occurs 1 time) or not (occurs 0 times). - Mike |
|
|
|
|
#12 (permalink) |
|
Design Destroyer
Join Date: Aug 2008
Location: Somewhere in Universe
Posts: 198
|
and here you can find probably a solution for your problem Url Routing with PHP - Part One : phpaddiction SIGNATURE ?
|
|
|
|
#13 (permalink) | |
|
What happened?
Join Date: Jul 2008
Posts: 1,827
|
Quote:
I meant that in a regular expression the character sequence "{0,1}" is equivalent to the single character "?". For example, the two following expressions will match the same strings: Code:
Code:
|
|
|
![]() |
|