Hi to all the experts here, I just would like to accomplish the following for my site www.domainname.com/*** to point to www.domainname.com/***.php Pls help urgently, much appreciated. Cheers malchiang
thx nintendo I will try it, I dun seem to have the .htaccess file in my apache2, where shd I create this file? much appreciated.
Nintendo, why did you add +Indexes ? It is not necessary to do this redirect and it is off by default for a reason...
Hi, So I just use the following? Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteRule ^([^.]+)$ $1.php [L]
just tried both lines in my .htaccess file I created in my web root dir, but it does not work cos when I key in domainname/*** it just gives me a 404 error, pls advise guys. Much appreciated.
hi nintendo I tried the following but it still gives me 404, any idea what I am doing wrongly? Thanks. Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^([^.]+)/$ $1.php [L] RewriteRule ^([^.]+)$ $1.php [L] Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteRule ^([^.]+)$ $1.php [L] Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^([^.]+)$ $1.php [L]
Indexes option is irrelevant for this. Now your 404 is probably due to a misunderstanding of how the rewrite works. Can you tell me what URL you tried to request when the 404 came up? e.g. if you tried example.com/test, are you sure there is a test.php on your server web root?
Hi krt, Yes I go to e.g. example.com/phpinfo.php it comes out but when I type in example/phpinfo I get the 404 error. Wat am I doing wrong?
Try a little test. Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^wacko\.html$ index.php [L] domain.com/wacko.html should then show the index.php file.
I think the htaccess file is not being processed, or is named incorrectly / not in your web root. Nintendo's test should be fine, you may also want to do this, I just use a .htaccess with nothing but an "x": x Code (markup): And there should be a 500 server error when you access any file in your site.
And if that test doesn't work, try just Options +FollowSymLinks for the first line, or with out any of it. Different servers might want different code or nothing there. My server for example needs both codes there. It would spit out a 404 error if I didn't have them, hince I use both codes.
sorri folks cos I am an idiot in apache, how do I make sure .htaccess file is correctly activated in apache as i had put it in /htdocs/ which is my root specified in http.conf, can you guys guide me the steps? Thanks.
No, it is the right spot. domain.com/.htaccess resolves to /path/to/web/root/.htaccess or htdocs/.htaccess in this case. malchiang, did you try what I suggested (in post #15)? What was the result? This will take a while to solve so if you want, try contacting your host, perhaps .htaccess files are not allowed. Also, if you are willing to give me FTP access, I can try find out the problem that way.
Hi gentlemen, i tried putting x in the .htaccess file but I am still able to access example.com/phpinfo.php, I am currently using a dedicated server running apache 2.24 pls help.