Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Redirect index.html and remove file extensions not working |
|
Author |
|
zeeman007
Joined: 12 Mar 2014 Posts: 1 Location: USA, Houston
|
Posted: Wed 12 Mar '14 16:26 Post subject: Redirect index.html and remove file extensions not working |
|
|
I'm not that well versed with this, so please excuse my noobness. Here's what i'm trying to accomplish. I want to (a) re-direct www.example.com/index.php to www.example.com (b) re-direct all other pages that end with .php to their respective pages such as www.example.com/about.php to www.example.com/about and (d) set the preferred canonical to "www." I showed someone the code from my HTACCESS below and they said it was completely wrong. Can anyone help me out here?
# -FrontPage-
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit POST PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.example.com
ErrorDocument 500 http://www.example.com
ErrorDocument 404 http://www.example.com
ErrorDocument 403 http://www.example.com
ErrorDocument 401 http://www.example.com
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.example.com/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L] |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Sat 16 Aug '14 17:46 Post subject: |
|
|
The RewriteEngine On needs to be above the rules as far as I know. And it needs to be in each vhost |
|
Back to top |
|
|
|
|
|
|