last day (14 days later) » 

6:32 AM
0
Q: Extensionless URL for root and subdirectories

conmenI has following htaccess rewrite rules which I wanted to changed to extensionless urls, its was working pretty well but there is a flaw when use it in sub-directory, for example: www.domain.com/cp/login doesn't show the page unless with extension www.domain.com/cp/login.php www.domain.com/co...

 
@JonLin, no htaccess file in cp directory, login is a php file instead of folder.
 
Comment out all the rules below RewriteRule ^(.*)$ $1.php [L] and then enter www.domain.com/cp/login in browser and see if that works. Does it throw 404 or just blank page?
 
@anubhava, it doesn't work, show 404
 
Does /cp/ folder have a .htaccess?
 
@anubhava, no htaccess reside in /cp/ folder
 
6:32 AM
Comment out all 3 RewriteCond lines and try rule: RewriteRule ^(.+?)/?$ $1.php [L]
 
@anubhava, I comment out first top 3 RewriteCond, it show 500 internal server error
 
ok just place RewriteCond %{REQUEST_FILENAME} !-f line before RewriteRule ^(.+?)/?$ $1.php [L]
 
ok, now www.domain.com/cp/login is working, but page at the root www.domain.com/about_us or www.domain.com/project/231/project-title doesn't work.
 
ok now you can uncomment all other rules below this rule
 
6:48 AM
www.domain.com/cp/login doesn't work again, pls see my edited post. Page under root are working.
 
checking
are you sure this .htaccess is in DOCUMENT_ROOT?
 
sorry, its reside on C:\xampp\htdocs \ _agent\
in live hosting, it should www.domain.com/_agent/cp/login
 
ah that's the reason
let me post an answer there
 
7:15 AM
Thanks @anubhava
 
you're welcome
take care & bye
 

last day (14 days later) »