Giter Club home page Giter Club logo

htaccess.madewithlove.com's People

Contributors

jdrieghe avatar woutersioen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

htaccess.madewithlove.com's Issues

REQUEST_FILENAME suggestion

It would be nice if there was a way to quickly indicate if the given URL is a file, a directory or neither.

I have seen a couple of suggestions here for an in depth approach that lets you define a whole directory structures and while this has merit I think it could become cumbersome for quick tests.

I would therefore like to propose that you simply add three radio buttons below the URL input to let users quickly specify how the given URL should be treated.

RewriteRule "^/foo$" "/bar" (Apache Docs)

Good evening!

First of all: thanks for your cool tool!

Maybe I'm getting something wrong at the moment.
According to the current Apache Docs the rule RewriteRule "^/foo$" "/bar" should redirect a request from http://example.com/foo to /usr/local/apache2/htdocs/bar (it's the example from https://httpd.apache.org/docs/current/rewrite/intro.html#rewriterule).

The tool always tells me that the rule didn't met... So what's going wrong here?

Kind regards! + Thank you!
Yorick

(Please excuse my weak English – I'm a student from Germany...)

GET parameters and hash string not working in RewriteRule

URL: http://domain.de/test/page/2

RewriteRule ^(.*)/page/([0-9]*)$ /$1/?lcp_page0=$2#lcp_instance_0 [PT]
does not work, it does not parse the string after ?, escaping will not solve it

The rule works without any problems in other htaccess testers and they also give me the full query string back as result including the get parameters and the hash string

output url: http://domain.de/test/
should be http://domain.de/test/page/2

debugging info:
RewriteRule ^(.*)/page/([0-9]*)$ /$1/?lcp_page0=$2#lcp_instance_0 [PT]

Support for ENV?

For example: http://domain.com/?foo=4&sunamy=4

    RewriteRule ^ - [E=MY_QUERY_STRING:%{QUERY_STRING}]
    RewriteRule ^ - [E=MY_QUERY_STRING:%1%2]
    RewriteCond %{ENV:MY_QUERY_STRING} ^(.+?&|)foo.*?(&.*|)$ [NC]
    RewriteRule ^ - [E=MY_QUERY_STRING:%1%2]
    RewriteCond %{ENV:MY_QUERY_STRING} ^(.+?&|)sunamy=.*?(&.*|)$ [NC]
    RewriteRule ^ - [E=MY_QUERY_STRING:%1%2]

htaccess_tester_-madewithlove-_2016-12-26_01_31_06

Implement "skip" syntax

We are using a "skip" syntax in out htaccess:

RewriteCond %{QUERY_STRING} !^item_id=4
RewriteRule .? - [S=6]
RewriteRule ^lernen/(.).php$ http://www.linguashop.com/hörbuch-$1? [R=301,L]
RewriteRule ^aprender-agora/(.
).php$ http://www.linguashop.com/frases/$1? [R=301,L]
RewriteRule ^apprendre/(.).php$ http://www.linguashop.com/$1-facile? [R=301,L]
RewriteRule ^aprender/(.
).php$ http://www.linguashop.com/frases-$1? [R=301,L]
RewriteRule ^imparare/(.).php$ http://www.linguashop.com/traduzioni-$1? [R=301,L]
RewriteRule ^learn/(.
).php$ http://www.linguashop.com/$1-download? [R=301,L]

This rule was met, the new url is /-ww.linguashop.com/lernen/polnisch.php
for the rule "RewriteRule .? - [S=6]" don't really seem appropriate.

Filed by David on June 17, 2014 at 12:28 pm

Command line interface

htaccess http://madewithlove.be

Uses the .htaccess file in the folder you are in and applies to rules.

Wrong new url in debugging info?

I think there might be an error displayed in the debugging info:

When I test some htaccess rules with the following lines:

Test-Url:

http://sub.domain.info

htaccess-Rules:

RewriteCond %{HTTP_HOST} ^sub.domain.info$
RewriteRule (.*) http://www.anotherdomain.com/$1 [R=301,L]

the debugging info displayed is:

The new url is http://sub.domain.info/
Test are stopped, a redirect will be made with status code 301.

Should not this redirect to http://www.anotherdomain.com ?

screenshot_2016-08-01_13 42 18

(sorry in case I should be wrong, but my webserver does indeed redirect to www.anotherdomain.com tested with these values)

"This condition was met." - highlighting

When a condition was met or not everything is marked in red.
This is a little bit confusing and i suggest that the conditions which were met are marked in green.

Does it work?

Maybe I am do not getting how this tool works, but it seems to not match the regex in any case.

Example:

RewriteEngine on
RewriteRule ^/$ /e/www/ [R]

Input:

http://test/

This rule was not met.

Display dedicated HTTP status code flags

This tool is brilliant, but could definitely be more comprehensive. Status codes are fairly important for SEO-based redirects; it would be nice if you detected flags like “G” ( for 410 Gone ) and displayed the relevant status code alongside the redirect URL. In the case of a 410, the URL is irrelevant as the server returns a “410 Gone” status for the source URL.

Otherwise, this tool has proved invaluable in validating that the .htaccess rules behave as requested.

Filed by Phil on March 8, 2013 at 4:45 pm

PHP Errors are showing

I'm not sure if you want this, but your php errors are showing. I can send you a screenshot if you want or post one here.

PT flag does not seem to work for RewriteRule entries

The following example does not follow through to the second rewrite rule

RewriteEngine On
RewriteBase /

# Drupal node to wordpress url mapping
RewriteCond %{QUERY_STRING} ^q=content\/(.*)$
RewriteRule . /drupal/%1? [PT]

RewriteRule drupal/example-article /2016/09/12/example-article/ [R=permanent,L]

I can confirm that this does work in a live environment.

Cheers,
Ty

share feature broken

Looks like as of yesterday the share feature no longer works.

You can generate the links fine but visiting them no longer loads the test.

To reproduce:

  1. write a test

  2. generate share link and copy it

  3. visit share link in new window / browser

Tested this on mac & windows on a combination of safari, firefox and chrome.

request filename suggestion

To enable request filename support it could be an idea to have an additional textbox where the user can paste their output from tree https://packages.debian.org/search?keywords=tree.

You then get this branch structure after running tree foldername which could be parsed

│   │   ├── json2.min.js
│   │   ├── masonry.min.js
│   │   ├── mce-view.js
│   │   ├── mce-view.min.js
│   │   ├── media-audiovideo.js
│   │   ├── media-audiovideo.min.js
│   │   ├── media-editor.js
│   │   ├── media-editor.min.js
│   │   ├── mediaelement
│   │   │   ├── background.png
│   │   │   ├── bigplay.png
│   │   │   ├── bigplay.svg
│   │   │   ├── controls.png
│   │   │   ├── controls.svg
│   │   │   ├── flashmediaelement.swf
│   │   │   ├── froogaloop.min.js
│   │   │   ├── jumpforward.png
│   │   │   ├── loading.gif
│   │   │   ├── mediaelement-and-player.min.js
│   │   │   ├── mediaelementplayer.min.css
│   │   │   ├── silverlightmediaelement.xap
│   │   │   ├── skipback.png
│   │   │   ├── wp-mediaelement.css
│   │   │   ├── wp-mediaelement.js
│   │   │   ├── wp-mediaelement.min.css
│   │   │   ├── wp-mediaelement.min.js
│   │   │   ├── wp-playlist.js
│   │   │   └── wp-playlist.min.js

Support headers which may not be set

On Acquia Cloud we use SSL termination on the LB layer, which adds a X-Forwarded-Proto, so an SSL enforcing rewrite rule would look like this [1]:

RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Regardless of the protocol i use in the testing url, the RewriteCond for this header will never be met, so the above sample will always fail with the "This condition was not met." message.

I suspect this is because non-existing headers always trigger a fail, but for my use-case it would be really useful if it was supported.

[1] - https://docs.acquia.com/articles/redirecting-traffic-between-http-and-https-acquia-cloud

Double escaped sequences aren't matched

.htaccess rules generated by some generators around the web generate output like this:

RewriteRule ^foo\-bar\-baz$ /new [L,R=301]

This works as expected on Apache/2.4.6, where /foo-bar-baz gets redirected to /new. However, http://htaccess.mwl.be/ doesn't match the URL /foo-bar-baz. Instead, it expects the literal URL /foo\-bar\-baz (including the backslashes!).

This is probably due to how Apache handles escaping URLs, it just strips all the \ characters from the URL somewhere in the process. As far as I'm aware, we can do just that after escaping the necessary characters in this tool.

It's a bit of an edge-case, but multiple generators have generated this output, so it'd only make sense for this checker to detect these cases.

Rewrite rule without regex should match the whole word

Thanks for this useful tool. But it's not working for me in the case of a partial match. If I put

RewriteRule page1 page2

It shows that http://example.com/page1.htm will be changed to http://example.com/page2.htm.

This is not what happens on my real server. The replacement string completely replaces the original. It does not do in-string substitution. So the real server gets http://example.com/page2 without the .htm extension.

Filed by Bob on Mon, 12 Aug 2013 13:50:04 CET

Empty line at the end of result when including < IfModule> tags

Here is an example that will give an empty button line with a strange evaluation.
http://localhost/salerferfoon

RewriteEngine on RewriteRule ^$ structure.php?p=main [L] RewriteRule ^saloon$ structure.php?p=saloon [L] RewriteRule ^rules$ structure.php?p=rules [L] RewriteCond %{REQUEST_URI} !=^/structure.php?p=error$ RewriteRule ^.*$ /structure.php?p=error [R]

There is an empy line that gives "This rule was met, the new url is http://localhost/structure.php?p=error\"

Emailed by Fede on June 18, 2014 at 3:21 am CET

RewriteBase should not be inserted into absolute paths

Consider:

RewriteBase /foo/
RewriteRule ^(.*)bar$ $1index.php [L]

In the tester, the above example correctly inserts the RewriteBase into the relative path if necessary.
http://test.com/bar > http://test.com/foo/index.php
http://test.com/foo/bar > http://test.com/foo/index.php

However:

RewriteBase /foo/
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]

In this case, the tester shows:
http://test.com > http://www.test.com/foo//

This is incorrect, since Apache doesn't apply RewriteBase when rewriting or redirecting to an absolute path.

Or not working correctly

The following code redirects primarydomain.com, secondarydomain.com and www.secondarydomain.com to www.primarydomain.com, but when you type primarydomain.com in the request url field the rule is marked as not met. This is not correct.

RewriteCond %{HTTP_HOST} ^primarydomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^secondarydomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.secondarydomain.com [NC]
RewriteRule ^(.*)$ http://www.primarydomain.com/$1 [R=301,nc,L]

or

It seems like you only can have one OR between each rule.

Problem with HTTP_HOST, contains REQUEST_URI

Seems to have some trouble with %{HTTP_HOST} in RewriteCond. The following code should drop the "www" from the URL but in doing so it duplicates the %{REQUEST_URI} in the output URL. I'm guessing its because the "(.+)" in the CondPattern is including the %{REQUEST_URI} but since CondPattern should only apply to the TestString of the RewriteCond - in this case %{HTTP_HOST} - the %{REQUEST_URI} should not be put in to the variable %1 of the RewriteRule, which I believe your script is doing.

RewriteCond %{HTTP_HOST} ^www.(.+) [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] #remove www from URL

Filed by Max on Mon, 26 Aug 2013 07:23:10 CET

Implement -f and -d by allowing to add existing files and directories

A suggestion for the following:

RewriteCond {%REQUEST_FILENAME} !-f
RewriteCond {%REQUEST_FILENAME} !-d

You can create two text boxes (since this is for testing). One for existing directories > (you can allow them to input directory paths). The other is for existing files. If an > existing file is in a non-existing directory make it warn the user.

Then you have something to check against the two conditions.

Filed by AbsoluteƵERØ on August 7, 2013 at 3:18 pm

Use Apache to evaluate

Did you think about using a real apache to evaluate the rules and parsing it's log output?
Or at least using the original mod_rewrite code ?

Share link is not working

I tried to share a test and the return link contains 'http' so when i tried to access this link he simply redirects me to a empty page.

Modifying the shared link to 'https' worked for me.

Crash when htaccess is commented out

Hi there -

Don't think too many people will run into this, but just so you know there's a hard crash when you run a test on an htaccess file that's all commented out. For example:

#RewriteCond %{HTTP_HOST} !=www.domain.com [NC]
#RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.