Unix/Linux Go Back    


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"

Web Programming


Tags
apache2, mod_rewrite

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 11-15-2013   -   Original Discussion by georgi58
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 Unix and Linux 11-15-2013   -   Original Discussion by georgi58
Neo's Unix or Linux Image
Neo Neo is online now Forum Staff  
Administrator
 
Join Date: Sep 2000
Last Activity: 13 December 2017, 11:38 AM EST
Location: Asia pacific region
Posts: 14,091
Thanks: 934
Thanked 1,270 Times in 608 Posts
You can try something like this:


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

Sponsored Links
    #3  
Old Unix and Linux 11-16-2013   -   Original Discussion by georgi58
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
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 09:09 AM
awk command to replace ";" with "|" and ""|" at diferent places in line of file shis100 Shell Programming and Scripting 7 03-16-2011 09:59 AM
How to make "enter" work in HTML syntax patilrakesh1984 Web Programming 2 11-26-2010 12:40 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 01:52 AM



All times are GMT -4. The time now is 12:54 PM.