Web Programming

Discuss Web Programming and Web Server Administration, including LAMP, Apache, MySQL, HTML, SEO, and other Web APIs and topics.

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


👤 Login to reply

 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-15-2013
georgi58's Unix or Linux Image
georgi58 georgi58 is offline
Registered User
 
Join Date: Apr 2012
Last Activity: 18 November 2013, 3:07 AM EST
Location: Bulgaria
Posts: 28
Thanks: 17
Thanked 0 Times in 0 Posts
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.
Sponsored Links
    #2  
Old 11-15-2013
Neo's Unix or Linux Image
Neo Neo is offline Forum Staff  
Administrator
 
Join Date: Sep 2000
Last Activity: 19 July 2018, 1:43 PM EDT
Location: Asia pacific region
Posts: 14,572
Thanks: 1,032
Thanked 1,437 Times in 697 Posts
You can try something like this:

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

Sponsored Links
    #3  
Old 11-16-2013
georgi58's Unix or Linux Image
georgi58 georgi58 is offline
Registered User
 
Join Date: Apr 2012
Last Activity: 18 November 2013, 3:07 AM EST
Location: Bulgaria
Posts: 28
Thanks: 17
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Neo View Post
You can try something like this:

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

returns "500" Internal Server Error
Sponsored Links
👤 Login to reply

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
The slices "usr", "opt", "tmp" disappeared!!! Help please. wolfgang Solaris 16 05-25-2012 08:09 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
How to make "enter" work in HTML syntax patilrakesh1984 Web Programming 2 11-25-2010 11:40 PM
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 06:40 PM.

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





Not a Forum Member?
Forgot Password?