help, htaccess

Discussion & Help for all web coding and scripting. Some languages include PHP, Ruby, Perl, XHTML, CSS, Javascript and XML.

help, htaccess

Postby anggit » Sun Jun 03, 2012 12:40 pm

hi, i try a mod rewrite in htaccess like this:
http://localhost/any -> http://localhost/any.php
but now the problem is i'm unable to access any directory, since http://localhost/directory will mod to http://localhost/directory.php.
any idea? :?
anggit
Junior Member
 
Posts: 53
Joined: Tue May 18, 2010 8:26 am

Re: help, htaccess

Postby Max » Mon Jun 04, 2012 1:41 am

Can't really help you unless you actually post your .htaccess file :P

Also just quickly, will it work if you put another slash after the directory?
Max
Administrator
 
Posts: 1031
Joined: Sat Jul 18, 2009 3:17 pm

Re: help, htaccess

Postby anggit » Mon Jun 04, 2012 12:07 pm

not work too, here is my .htaccess:
Code: Select all
RewriteRule ^([-0-9a-z]+)/?$ $1.php [NC,L]

as i said before, then my main problem is i'm unable to access my files :x

thank you, :idea: i think the problem was fixed by adding a conditional in htaccess, then it would be like this:
Code: Select all
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([-0-9a-z]+)/?$ $1.php [NC,L]


\ :D /
anggit
Junior Member
 
Posts: 53
Joined: Tue May 18, 2010 8:26 am

Re: help, htaccess

Postby Max » Tue Jun 05, 2012 3:38 am

It's all good now then?
Max
Administrator
 
Posts: 1031
Joined: Sat Jul 18, 2009 3:17 pm


Return to Coding and Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron