Sponsored Content
Full Discussion: Rewrite wrong request
Top Forums Web Development Rewrite wrong request Post 302873799 by georgi58 on Thursday 14th of November 2013 03:24:15 AM
Old 11-14-2013
Quote:
Originally Posted by Scott
Something like:
Code:
RewriteRule (.*\.html).*\.html$ $1 [R=301,L]

http://htaccess.madewithlove.be

works great!
thank you very much.

---------- Post updated at 02:16 PM ---------- Previous update was at 02:13 PM ----------

Quote:
Originally Posted by Neo
You should find out why a bad URI is returning a 200 status code.

Perhaps you have some rewrite rules already that are effecting this?
you are right, but I could not find what causes this. Anyway, will leave it with the working solution from Scott.
thank you for your point.

---------- Post updated 11-14-13 at 10:24 AM ---------- Previous update was 11-13-13 at 02:16 PM ----------

Quote:
Originally Posted by Scott
Something like:
Code:
RewriteRule (.*\.html).*\.html$ $1 [R=301,L]

http://htaccess.madewithlove.be
Scott, please tell me how this line will look like no matter what characters are after the first ".html"

thank you one more time
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Apache Rewrite help!

I am trying to write RewriteRule on Apache_1.3.26 to get users web page from another server. for example if users tries to get web page on www.somedomain.com/~usersname it will get the web page from www.testdomain.com/~username without redirect and users will not be aware of any redirect... (1 Reply)
Discussion started by: hassan2
1 Replies

2. Shell Programming and Scripting

How do I rewrite to use a while instead of find?

for FILE in `find /home/Upload/*` Need to use a while instead to prevent errors when the file is emptied (4 Replies)
Discussion started by: goodmis
4 Replies

3. Shell Programming and Scripting

How to rewrite a line in a file

Hi Can anyone tell me how can rewrite a line in a file by using line number? I tried to use sed by failed to do so. For example HELLO 179.390 111.560 HOW TO DO WHAT TO DO to become HELLO 200 3000 HOW TO DO WHAT TO DO (21 Replies)
Discussion started by: c0384
21 Replies

4. Shell Programming and Scripting

grep help, how do i rewrite this

Thanks , franklin you method worked, i knew i had to use a while loop and getline in there just didnt know the proper order :) Hi everyone, im trying to make the following command line shorter by introducing a script that join up all the grep commands ./new1a < numbers.txt | grep -i -v '^a '... (5 Replies)
Discussion started by: weezybaby
5 Replies

5. UNIX for Dummies Questions & Answers

rewrite date

I'm looking to have function that takes the present month and rewrites it into this form: _06_ (june), _09_ (september), and so on.. I would like this to be a my $this_month=code that rewrites date function because I would like to be a able to call it multiple times in the script by writing... (5 Replies)
Discussion started by: marringi
5 Replies

6. Web Development

Need help with rewrite rule

Hi, I hosted my site on Apache web server. I wanted to redirect all the users request to a HTML page(maintenance page). I used the below rewrite rule to do ths same. RewriteEngine on RewriteRule .* /maintenance.html The maintenance.html page contains an image. When ever I try to... (2 Replies)
Discussion started by: BSrikanthB
2 Replies

7. Shell Programming and Scripting

Why result is wrong here ? whether break statement is wrong ?

Hi ! all I am just trying to check range in my datafile pls tell me why its resulting wrong admin@IEEE:~/Desktop$ cat test.txt 0 28.4 5 28.4 10 28.4 15 28.5 20 28.5 25 28.6 30 28.6 35 28.7 40 28.7 45 28.7 50 28.8 55 28.8 60 28.8 65 28.1... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies

8. Linux

Rewrite proxypass

Hi, I have a Apache 2.0 web server. When a users comes in to sitea.com a check is applied if the path ends with *t*, the user hits a rewrite rule that adds an environment variable called x is hit with a proxypass. This has worked successfully in the past, but recently I added another rewrite... (0 Replies)
Discussion started by: 3junior
0 Replies
Tie::DxHash(3)						User Contributed Perl Documentation					    Tie::DxHash(3)

NAME
Tie::DxHash - keeps insertion order; allows duplicate keys SYNOPSIS
use Tie::DxHash; my(%vhost); tie %vhost, 'Tie::DxHash' [, LIST]; %vhost = ( ServerName => 'foo', RewriteCond => 'bar', RewriteRule => 'bletch', RewriteCond => 'phooey', RewriteRule => 'squelch', ); DESCRIPTION
This module was written to allow the use of rewrite rules in Apache configuration files written with Perl Sections. However, a potential user has stated that he needs it to support the use of multiple ScriptAlias directives within a single Virtual Host (which is required by FrontPage, apparently). If you find a completely different use for it, great. The original purpose of this module is not quite so obscure as it might sound. Perl Sections bring the power of a general-purpose programming language to Apache configuration files and, having used them once, many people use them throughout. (I take this approach since, even in sections of the configuration where I do not need the flexibility, I find it easier to use a consistent syntax. This also makes the code easier for XEmacs to colour in ;-) Similarly, mod_rewrite is easily the most powerful way to perform URL rewriting and I tend to use it exclusively, even when a simpler directive would do the trick, in order to group my redirections together and keep them consistent. So, I came up against the following problem quite early on. The synopsis shows some syntax which might be needed when using mod_rewrite within a Perl Section. Clearly, using an ordinary hash will not do what you want. The two additional features we need are to preserve insertion order and to allow duplicate keys. When retrieving an element from the hash by name, successive requests for the same name must iterate through the duplicate entries (and, presumably, wrap around when the end of the chain is reached). This is where Tie::DxHash comes in. Simply by tying the offend- ing hash, the corresponding configuration directives work as expected. Running an Apache syntax check (with docroot check) on your configuration file (with "httpd -t") and checking virtual host settings (with "httpd -S") succeed without complaint. Incidentally, I strongly recommend building your Apache configuration files with make (or equivalent) in order to enforce the above two checks, preceded by a Perl syntax check (with "perl -cx"). INTERNALS
For those interested, Tie::IxHash works by storing the hash data in an array of hash references (containing the key/value pairs). This preserves insertion order. A separate set of iterators (one per distinct key) keeps track of the last retrieved value for a given key, thus allowing the successive retrieval of multiple values for the same key to work as expected. SEE ALSO
perltie(1), for information on ties generally. Tie::IxHash(3), by Gurusamy Sarathy, if you need to preserve insertion order but not allow duplicate keys. For information on Ralf S. Engelschall's powerful URL rewriting module, mod_rewrite, check out the reference documentation at "http://httpd.apache.org/docs/mod/mod_rewrite.html" and the URL Rewriting Guide at "http://httpd.apache.org/docs/misc/rewriteguide.html". For help in using Perl Sections to configure Apache, take a look at the section called "Apache Configuration in Perl" at "http://perl.apache.org/guide/config.html#Apache_Configuration_in_Perl", part of the mod_perl guide, by Stas Bekman. Alternatively, buy the O'Reilly book Writing Apache Modules with Perl and C, by Lincoln Stein & Doug MacEachern, and study Chapter 8: Customizing the Apache Configuration Process. BUGS
The algorithms used to retrieve and delete elements by key run in O(N) time, so do not expect this module to work well on large data sets. This is not a problem for the module's intended use. If you find another use for the module which involves larger quantities of data, let me know and I will put some effort into optimising for speed. The mod_rewrite directives for which this module was written (primarily RewriteCond and RewriteRule) can occur in all four con- figuration file contexts (i.e. server config, virtual host, directory, .htaccess). However, Tie::DxHash only helps when you are using a directive which is mapped onto a Perl hash. This limits you to directives which are block sections with begin and end tags (like <VirtualHost> and <Directory>). I get round this by sticking my mod_rewrite directives in a name-based virtual host container (as shown in the synopsis) even in the degenerate case where the web server only has one virtual host. AUTHOR
Kevin Ruscoe perl v5.8.0 2001-06-15 Tie::DxHash(3)
All times are GMT -4. The time now is 02:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy