Hello, I am trying to set up my URL settings, and I have some requirements that I’ve already asked for, but my last problem was the following:
If a user, for example, tries to access site.com/foo.php, they should be redirected to site.com/foo; and conversely, if a user enters site.com/foo they shouldn’t be redirected but the requested page should be site.com/foo.php.
Here is my .htacces:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)\.html$
RewriteRule ^.*\.html$ %1.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php
AddType application/x-httpd-php .htm .html
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Redirect /anmeldung http://www.site.com/register
Redirect /anmeldung.htm http://www.site.com/register
Redirect /anmeldung.html http://www.site.com/register
Redirect /anmeldung.php http://www.site.com/register
Redirect /registierung http://www.site.com/register
Redirect /registierung.htm http://www.site.com/register
Redirect /registierung.html http://www.site.com/register
Redirect /registierung.php http://www.site.com/register
Redirect /register.htm http://www.site.com/register
Redirect /register.html http://www.site.com/register
If there is someone who could help me out, I’d really appreciate it.
Thanks a lot.
UPDATE:
The full htaccess:
RewriteEngine On
EewriteRule ^(.*)\.(php|html)$ /$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ /$1.php [L]
Redirect /anmeldung http://www.site.com/register
Redirect /anmeldung.htm http://www.site.com/register
Redirect /anmeldung.html http://www.site.com/register
Redirect /anmeldung.php http://www.site.com/register
Redirect /registierung http://www.site.com/register
Redirect /registierung.htm http://www.site.com/register
Redirect /registierung.html http://www.site.com/register
Redirect /registierung.php http://www.site.com/register
Based on my assumption comment above you should try