htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: A problem you might say
PostPosted: 16 Jan 2008 19:56 
Offline

Joined: 16 Jan 2008 19:48
Posts: 1
Ok so hello! This is my first post on htaccesselite.com and i hope it proves to be a good one.

Before i tell you what my problem is, i will show you my current code.

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^index\.php$
RewriteRule (.*) /index.php?p=$1 [L]
</IfModule>


My problem:

When ever i go to say mydomain.com/wankernerer

Obviously my PHP script will present a 404 page because it can't select that page from the database (because it dosen't exist)

But if i physically created the direcotry wankernerer i am still presented with the same 404 page because HTACCESS is telling my script to look for that page.

So basiclly, my question is: How to i get .htaccess to realise that there is a directory there, and to directory list it's contents?



Enso Web Design


Top
 Profile  
 
 Post subject:
PostPosted: 17 Jan 2008 03:09 
Offline

Joined: 30 Jan 2007 11:20
Posts: 33
Thanks for posting your code and question the right way Base.

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^index\.php$
RewriteRule (.*) /index.php?p=$1 [L]
</IfModule>


has a problem, that $1, is incorrect.. what are you trying to say that $1 equals here?


Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^index\.php$
RewriteRule (.*) /index.php?p=$1 [L]
</IfModule>


Also, if you created a folder /folder/ you can only view the directory contents by adding this.

Code:
Options +Indexes


And if you have an index.php or index.html file in /folder/ it will only show it if you have directory indexing turned on. ie
Code:
DirectoryIndex index.php


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB