Home Man
Search
Today's Posts
Register

Javascript, Javascript libs and toolkits, LAMP, Apache, MySQL, HTML, and other web coding posts.

Rewrite ".html/..." to ".html"

Tags
apache2, mod_rewrite, web

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 11-15-2013
Rewrite ".html/..." to ".html"

Hi folks,

Two days ago I asked you for help and got what I asked for in the following thread

https://www.unix.com/showthread.php?p...#post302873799

After that I tested my .htaccess line by line and found what causes Apache to serve malformed and non-existing URL-s. The following line

Code:
AddType x-mapp-php5 .php .html .htm .shtml

An extended search gave no results to solve the problem. If I remove the line all is ok, but I really need it there since I need PHP for serving Google adds in my website and the only way to have it on 1and1 shared hosting is by that line (I got it from 1and1 support).
I also found other URL-s ending on .html/some characters which SE are indexing as pages from my website.

The only solution at the moment for me seems to be: to rewrite all bad url-s to correct ones i.e.
to rewrite all ending on
Code:
.html/any_characters

to
Code:
.html

Appreciate all your help.
# 2  
Old 11-15-2013
You can try something like this:

Code:
RewriteRule ^(.*)\.html(.*)$    $1.html  [R=301, L]

# 3  
Old 11-16-2013
Quote:
Originally Posted by Neo
You can try something like this:

Code:
RewriteRule ^(.*)\.html(.*)$ $1.html [R=301, L]

returns "500" Internal Server Error
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Expect: spawn id exp5 not open while executing "expect "$" { send "sudo su -\r" }" Siddharth shivh Shell Programming and Scripting 3 05-31-2018 10:46 AM
Using "mailx" command to read "to" and "cc" email addreses from input file asjaiswal UNIX for Dummies Questions & Answers 2 10-11-2014 09:32 PM
"Content-type: text/html No input file specified." Only in CRON but not when executed directly phpchick Shell Programming and Scripting 2 06-11-2014 12:25 PM
Find lines with "A" then change "E" to "X" same line nightwatchrenba Shell Programming and Scripting 10 08-28-2013 05:00 AM
awk command to replace ";" with "|" and ""|" at diferent places in line of file shis100 Shell Programming and Scripting 7 03-16-2011 08:59 AM
Make scipt except from "Y","y" and "yes" to take [Enter] as being "yes" hakermania Shell Programming and Scripting 4 12-11-2010 09:24 AM
How to make "enter" work in HTML syntax patilrakesh1984 Web Programming 2 11-25-2010 11:40 PM
ps -ef | grep "string1" "string2" " "string3" steve2216 Shell Programming and Scripting 11 09-03-2010 11:08 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 12:52 AM


All times are GMT -4. The time now is 01:38 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password