Click here to Skip to main content
15,845,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

Options -Indexes 
# quick custom error "document"..
ErrorDocument 404 "<html><head><title>NO!</title></head><body><h2><tt>There is nothing here.. go away quickly!</tt></h2></body></html> 

Options +FollowSymlinks
RewriteEngine on
RedirectMatch /$

# Pass Through the empty request (to be handled as DirectoryIndex)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /?\ HTTP
RewriteRule .? - [PT]

# If index or index.php requested, strip and redirect
RewriteCond %{THE_REQUEST} index(\.php)?
RewriteRule ^index(\.php)?$ [R=301,L]

# Remove PHP extension from links if NOT subrequest
RewriteRule ^(.+)\.php$ $1 [R=301,NS]

# Serve PHP extension from links
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ /$1.php [L]

i use this code.but its not work properly.pls correct this code or give some other code

[Edit]Code block formatting added[/Edit]
Updated 10-Jul-13 4:41am

1 solution

You cannot hide anything from the address bad using .htaccess, or anything else. This is the client-side element, nothing in a Web application can get any access to the browser.

However, you can use, in particular, such thing as URL rewriting, which is totally different thing, but it can help you:[^].

If this is something you may want, consider this nice tool helping you to write appropriate .htaccess:[^].

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900