Space Cat, Prince Among Thieves

Batch RewriteRule Generator

Find this useful?Buy me a coffee!

PayPal:

GitHub:

I find myself often needing to set up a large number of 301 redirects from an excel file of old to new url’s. Until this point, writing these had been a fairly exhausting process as you need to be certain to escape every character that could be picked up by the regular expression engine, or risk unintended consequences. On top of that, writing these rewrites to catch GET parameters in any order is complex to say the least. While working through a large list of 301s for a very picky server where Redirect 301 style redirects were not an option, I began setting up RewriteRule's by hand and decided there had to be a better way. Voila! My 301 RewriteRule Builder was born.

Excel Usage Example

You can simply enter a list of tab or space delimited urls (copied from Excel works great) and it will spit out the generated RewriteRule’s for you. GET parameters on the old urls are broken up and built into multiple RewriteCond’s set up to work in any passed order.

I hope someone finds this useful. Any comments are welcome below, of feel free to fork me on github!

Please make sure you have RewriteEngine On somewhere near the top of your .htaccess, before you attempt any rewrites.

Need more help? The tool can only do so much, and sometimes you need human help. I offer .htaccess help as a paid service and have 10+ years of Apache experience. Send me a note on my contact page and we can discuss your options.

Fork my source on Github!

Comment by: Dan Shields on

I can't believe no one has commented. This thing is the greatest tool ever. I would have figured someone had created this but when searching not much was showing up and you just saved me hours of converting 6 hundred or so urls.

Thanks so much!!

Comment by: Chandra on

Hey Buddy, I have no words to express.. This is a great tool and you saved my time a lot .. thank you soooooooo much. God this is a wonderful tool :-)

Comment by: Night Lion on

LIFE SAVER. Thanks!

Comment by: Martin Emmert on

Thanks! You saved me a lot of trouble and pain!!

Comment by: Mike on

This is just wonderful. Saved me a bunch of mind-numbing data entry. Such a useful tool. THANK YOU!

Comment by: corey on

This tool is the sex

Comment by: eg on

Thanks! You're a life saver!

Comment by: Gareth on

Saved me a huge amount of time and confusion. Many thanks.

Comment by: Anton Evers on

Nice, I'll be using this one more often. I'll fork it too. See if I can tweak the order of the rules so general rules come after specific ones.

Comment by: Anton Sombetzki on

Thanks, first tool I could find that actually works with get parameters! Really nice, bookmarked!

Comment by: Foxman on

Brilliant :) It actually works!!!!! thanks and well done!

Comment by: aseran on

I agree with you all guys this tool is truely life saver...

Comment by: Anne-Mieke Bovelett on

Where's your PayPal donation button??? This is GREAT stuff!

Comment by: Marc Heatley on

Thanks for this amazing tool! It's a total lifesaver.

Comment by: Alex on

Really you need a donate button. You don't understand how much this helped me. Thank you so much for making my life so much easier!

Comment by: danna on

This is great... and over 2 years later even. Thanks so much!

Comment by: Duane on

Thanks so much for such an incredibly great tool!

Comment by: Sagan on

This tool just made my life incredibly easy. We had to create 500 redirects for the relaunch of an ecommerce platform, and this made it incredibly easy. Thank you for making this tool!

Comment by: Eric on

The perfect tool I've been searching for 3 hours! Thanks a lot I bought you a beer ;-)

Comment by: Nathan Gaw on

A very useful tool - thanks for putting it together. I bought you a beer. cheers.

Comment by: Raymond on

VERY useful online tool! Thanks for this.

Comment by: Don on

Thank you, for this tool. Confirmed. Working like a charm.

Comment by: Eamonn on

Great work, if only I had found this a a few years back it would have saved a few sleepless nights. Well done!

Comment by: Given on

I salute you. This is awesome :)

Comment by: Vickie on

Man, you totally rock! I was just about to give up. Enjoy the beer :D

Comment by: kalyan on

Helped me a lot . Good job guys

Comment by: charles on

awesome tool. thank you so much!

Comment by: Olli on

This tool is absolutly awesome and error free. All the best :-)

Comment by: Shaun on

Awesome. Thanks. Was stocked when I came across this. Thanks!

Comment by: Koen on

Great tool! Thanks it helps me much

Comment by: David on

OMG. Thank you. No kidding, I spent over 10 hours today and yesterday trying to decipher Rewrites for some very complicated URLs. This solved it immediately. This is truly an invaluable tool.

I love that it does bulk processing, but I'm way more impressed with the fact it can decipher irregular characters. It's exceptional!

BRAVO!

Please contact me, and I'll send you a free graphic t-shirt from GAFY.com!

Comment by: Matt on

You are a CHAMPION for creating this. Thank you SO. MUCH. I will gladly buy you beer. Buy this man beer, people!

Comment by: mabin on

Awesome tool

Comment by: Andy on

Hi, great tool but if you have hundreds of redirected urls what do you do with the home page re-direct?
Does it go at the bottom of the file? top? and how does it work so the rest of the urls are not skipped please?
Cannot find any info for this when using a htaccess methodnad need to find a working method fast as website now transferred to brand new domain.

Comment by: Jesse G. Donat on

The order actually shouldn't matter at all when using rewrites this creates as it strictly matches.

Entering the following for redirect

http://foo.com  http://bar.com

Returns the following.

RewriteCond %{HTTP_HOST} ^foo\.com$
RewriteRule ^$ http://bar.com/? [L,R=301]

The ^$ means [start][finish] and indicates that this only strictly matches empty so it won't bleed into other matches.

As such you will also want one for index.html/index.php/whatever the real url for your homepage is.


Comment by: David on

All your base are belong to us because this tool is the ish.

I've saved a lot of time! Thanks for the hard work.

Comment by: Hetal Shah on

Thanks a ton Donat Studios for this excellent tool of rewrite generator. I had been struggling for two days for getting my .htaccess codes right, but this tool solved my problem instantly. Thanks once again !!

Comment by: helen on

Thank you, a very useful tool.

Comment by: Michael van Bevern on

THANK YOU SO MUCH! You solved my day!

Comment by: Lance on

This tool is so cool!

Comment by: Luke on

Dude, this tool is so sweet. I'm glad to see you still maintain it. As thanks I bought you a beer last time and I highly encourage others to buy you one too.

Comment by: Philippe on

Great !! Thanks a lot. The htaccess rules are perfectly applied. This 301 generator is the best that I had discovered... until now.

Comment by: Samantha on

Thank you so much. I have had to do a large number of these on several occasions now. This has saved me sooooooooo much time. Great tool! Thanks again.

Comment by: saravanan on

I need to have this work for all of my pages. Please let me know how to do it.Below is my code that works for single page

RewriteCond %{QUERY_STRING} (^|&)where=Oakland%2C\+CA($|&)
RewriteCond %{QUERY_STRING} (^|&)keyword=Beauticians($|&)
RewriteRule ^results\.php$ /results.php/k/Beauticians/Oakland/CA? [L,R=301]

Comment by: jon on

well done man, thanks so much, there is nothing else like this out there!

Comment by: Helias on

I can make it work . I put the generated code into .access and in vhosts.conf file under but server doesnt seem to care. any ideas? p.s I restarted apache services too and in cong file mod_rewrite is enabled and uncommented . apache v 2.2

Comment by: Helias on

Ok the generated code works great, my problem was that i had to add parameters for allowing overrides in vhosts.conf for my vserver. Great tool !!!

Comment by: kamal on

love your tool, it is useable in real sense.

Comment by: Ashok Maharjan on

Thanks, this is an awesome tool. Really save my day. :)

Comment by: Ivan on

Hi, i´m trying to redirect two kinds of urls but any of them works.

Examples:
1: www.asdasd.com/anuncios/buscar/1/?cat=190&buscar_anuncio=Buscar www.asdasd.com/inmuebles/
2: www.asdasd.com/anuncios/buscar/1/54/ www.asdasd.com/gibraltar/

Number 2 works with redirect 301 /anuncios/buscar/1/54 asdads.es@/gibraltar

Does anyone can help me?

Thanks for help :)

Comment by: Jesse G. Donat on

Have you tried adding http://? The links will be processed a little differently when it realizes these are full url's and not relative paths.

Comment by: Ivan on

Yeah i tried, all the urls have the http protocol, but i can´t copy the exact url cause the comments doesn´t accept urls.

Comment by: Simone on

I love this ... thank you

Comment by: Jaime on

Hi Jesse, thanks for this great tool!!

Do you know if it´s possible to make some kind of redirection specifying not only the path but also the domain of the old urls?

I need it because I am moving from a Joomla multi-domain website to a Wordpress multi-domain website and I have some identical paths in the old website like these:

www.doamin.com/news.html
www.domain.fr/news.html

So a simple redirect like below always send me to the .com (even in the french scenario) which is the main domain in the multi-domain hosting:

Redirect 301 /news.html http://www.domain.com/category/news/
Redirect 301 /news.html http://www.domain.fr/category/nouvelles/

At this moment the old site is at the ftp root and the new one is in a production subfolder but I have to delete the oldsite and move the new one to the root.. I would need to have the htaccess managing the redirections of all the pages from the oldsite to the new one. I have no problems with the old urls with different paths but, what can I do with the urls with the same path?

I only have one htaccess, since both domains are mangaged from a single CMS installation. (Old joomla site managed the domains with Joomfish plugin and the new wp site manage the domains with WPML).

Thank you!!

Comment by: David on

Utterly brilliant. Thanks! Saved me a lot of time doing it by hand.

Comment by: Tom on

GREAT!!! Thank you!

Comment by: Juliette on

This is awesome! Thanks for this.

Comment by: Colin on

This tool is the dogs! thanks for creating :)

Comment by: Greg on

This is so great! Thanks so much! You just saved me a bazillion hours of manual coding!

Comment by: Curtis on

Brilliant! Hats off to you, sir!

Comment by: Alex on

Thank you very much!!!

Comment by: Guus on

Awesome! Thanks a lot for this wonderful tool!

Comment by: Lorri on

lifesaver! was using the cpanel redirect which broke old cs-cart shopping cart urls (index.php?target=categories&category_id=171) - went through a few rules & tried, then decided there has got to be a generator - went through a few generators - yours is the ONLY one that worked!

Comment by: Scott on

I can't even begin to explain how much time you just saved me. THANK YOU!!

Comment by: Alex on

Beautiful tool! Literally shaves hours off large redirect jobs.

Comment by: Jelmer on

Thanks for this !!! Bookmarked for life :)

Comment by: Dave Reeder on

Thanks, great tool!
This is the only tool that came up with a working redirect for some 404s I had.

Comment by: Evert on

Cool, amazing tool.
I love those simplicity tools that are doing what there are designed for.

Comment by: David on

Really good job. Works like a charm.

Comment by: Umal on

This is a great tool. Idea is so awesome. Works like charm. Do you have something which can be used to read the existing redirects conf file and update the rewrite rules already present.

Comment by: Kevin on

AMAZING! Thank you so much!

Comment by: Hans Wassink on

Thanks Jesse! You are a true G. :) Lifesaver...

Comment by: kikos on

I have a form with a google map lieke that
http://www.immofind24.de/index.php?controller=pjListings&action=pjActionMap
and i want
http://www.immofind24.de/immobilien-karte.html ..The rewrite is working but the form doesent show anything ..and a field ist already selected with a value ...any ideas ?

Comment by: Russ on

Great tool! Thanks. Quick question. I have thousands of old forum links, like this: http://www.fairmontschools.com/Default.aspx?PageID=6849060&A=WebApp&CCID=15683&Page=2&Items=6. They all follow the same pattern, to a point. All of them have http://www.fairmontschools.com/Default.aspx?PageID= and then everything after the equals sign changes. Is there a way to write line in the htaccess file that basically says "anything that has the pattern of http://www.fairmontschools.com/Default.aspx?PageID= should 301 redirect to http://www.fairmontschools.com" ?

Comment by: Roger F. on

Great tool and real time saver! Was worth for a donation...

Comment by: zonko on

awesome - thanks for this lifesaver

Comment by: bobyfromuk on

Best generator of all time! All he is doing!

Comment by: novasta on

very usefull, thank you.

Comment by: Dan Judge on

Great tool, thanks for this.

Comment by: Joe on

This is simply amazing. I have been running into query string 301's a lot lately and this is the first usable tool, and arguably the best.

How could one modify it slightly to do the following?

I would want to remove the http host condition as I set the first redirect to push the www to non www version of the site. That condition is already met when I get to my 301's so I don't include it anymore on the individual ones.

Second, how can the output be set the RewriteRule starts with ^(.*)$ instead of the previous html page? in many cases any html page can generate the url so this accounts for all of them?

Again, simply amazing... even without my anal retentive tweaks.

Comment by: Muyassir on

Thank you!
It really helped and saved time.

Comment by: James on

THANK YOU. You are awesome!

Comment by: Paul on

Simply wonderful! You took a mind-numbing task and turned it into a quick and painless process. Thank you!

Comment by: Mohsin Khan on

Killing tool Dudes. Totally flat. Rewrite 5,000 URL's in couple of seconds.... Awesome. Thank-You.

Comment by: Ashley on

Fantastic! "It just works!" And to anticipate I'd be using Excel for input was all the better. I used it, tested it, then looked for the donation link to contribute. THANK YOU!

Comment by: Marshall on

Oh. My. Gawd.

This is so incredibly awesome that it goes right past being incredibly awesome, goes all the way around, and comes back to being incredibly awesome.

And you. You're equally incredibly awesome for making it.

Wow.

Comment by: Dmitry on

Excellent work. You are cool guy. Thanks for this tool :)

Comment by: Sherissa on

Awesome tool! thank you.

Comment by: dutch guy on

Yessss, this is the supa dupa UBERtool when it comes to creating 301 batchfiles!
Great one, cheers!

Comment by: R34nimated on

Quality tool, saved me about an hour today. Thanks a bunch.

Comment by: David @ eltallerdelbit on

Hey! really useful tool!
Like to use it to make my redirections and rewrites ;-)

Thanks!

Comment by: Lamari Abderrahim on

Great work, thank you so much.

Comment by: cataman on

Good Job! thanks bro...

Comment by: Alonzo on

Perfect! I was having a headache, but this solved it! Thanks!

Comment by: andre on

Perfect, thank you for this tool !

Comment by: Amy on

Let me add a "me, too" for this amazing tool--200+ redirects accomplished in 30 seconds. This is the best.

Comment by: Mariel on

This tool can be used with cms word press friendly url.?
If I can enter a friendly url and it create the correct 301 redirect.?

Comment by: Shervin on

Great tool man, You deserve donation for your great work :)

Comment by: damian on

It's good. I'd recommend adding some options, such as with/without www and with/without closing "/" at the end of a link. Of course, user would have to be more aware of what they're pasting.

Comment by: Angela Tucker on

Wow!! Thanks so much on this great time saving tool!! Much appreciated!!

Comment by: Adrian on

Thank you dearly! I tried a bunch of other generators but none were as good and accurate as this. Thanks a lot.

Comment by: Atur on

THANK YOU !!!!!!!!!!!

Comment by: cxvxcvxcv on

THX

Comment by: farzad khaledi on

Thank you for your great tools,it's work very good :)

Comment by: Alex on

Hi! I generate

# 301 --- /shop/dekorativnye-plenki/category/32-karbon?route=product/category&path=25_32 => /dekorativnye-plenki/karbon
RewriteCond %{QUERY_STRING} (^|&)route=product/category($|&)
RewriteCond %{QUERY_STRING} (^|&)path=25_32($|&)
RewriteRule ^shop/dekorativnye-plenki/category/32-karbon$ /dekorativnye-plenki/karbon? [L,R=301]

But as a result my server redirect me non existed page

/shop/dekorativnye-plenki/category/32-karbon?route=product/category&path=25_32

What is wrong?

Comment by: Voogarix Beethon on

Thank you very much dude.

Comment by: Sumesh on

Do we have any script which does the reverse.

.htaccess file with 1000s lines of redirects, need to convert these into a table data

Comment by: Tim on

The rewrites didn't work for me, but the 301s did.

Comment by: karpel on

Example:
http://www.site.ru/index.php/images/images/file/images/images/index.php	/test/
return not correct.

Comment by: Jesse G Donat on

It’s doing exactly what you told it to, which computers are one to do. I believe what you meant was:
http://www.site.ru/index.php/images/images/file/images/images/index.php	http://www.site.ru/test/
Update: As this is a common source of error for people I've updated it to better handle FULL→Relative URIs.

Comment by: Naquan on

It WORKS!!!! Thank you!

Comment by: Alex on

Amazing tool - love the rewrites - was able to use it for special characters, such as query strings, which you can't do with redirectmatch 301

Lifesaver!

Comment by: Marco on

All you deserve is love. Thanks mate.

Comment by: Ben on

Awesome tool - thank you for this it's saved tons of time

Comment by: Matt on

Just the best there is!!

Comment by: Justin on

Hello,

Will this work for http > https ?

example...

http://domain.com/cart/ to https://domain.com/cart/ ?

Comment by: César on

Thanks a lot!

Comment by: Manish on

This fails if I have a space or a "%20" in my old url. Any ideas?

Comment by: Manish on

If you have a space in the old URL, replace it with "\ " in the htaccess file.

EX: http://domain.com/sub directory/
http://domain.com/sub\ directory/

Comment by: Julian on

This tool makes me cry happy.
THANK YOU!

Comment by: Reno on

Hello thanks for this great tool! Was wondering if it can be used for Nginx server too?

Comment by: Christian on

%^&*ing great tool > 400 redirects within a wink!

Let the comments on to make debug easier later!

THANK YOU!

Comment by: Brian on

Many thanks for making this great tool available.

Much appreciated.

Brian

Comment by: Alpakka on

Reno: this can be used for nginx configurations, if u combine this with a .htaccess -> nginx converter, such as https://winginx.com/en/htaccess

You need basic understanding on nginx blocks (to avoid duplicates etc with your existing configurations), but I quess you have that if ur working with nginx.

Just did around 100 Rewrites combining these 2 tools. Amazing.

Comment by: Jorge on

Hello,

I'm trying to get rewrite but don't work for me. Can you help me. Now I have 6000 Redirec 301 and I would like to convert into rewriterules.

Comment by: Alex on

I donated again. I've used this tool many times. I can't thank you enough for this.

Comment by: itzik glam on

amazing
thank you

Comment by: Imran on

Hi,

I'm about to use this to redirect 9000 .asp pages to static HTML links which are all Magento pho.

Will this work with asp pages as the old page:

E.g.

Www.oldpage.com/store/product.asp=1234

To

Www.newpage.com/bed.html

Comment by: Hamish Lowry-Martin on

Just sent ya a beer, thanks for the tool

Comment by: Dmitriy on

thanks for the tool

Comment by: Andrew Lee on

You're awesome

Comment by: Lesscro on

made a small donation because u help me everyday in my work... Really a piece of work when needed !!!

Comment by: Patrick Büttgen on

Nice Tool, thank you!

Comment by: Pro Bg on

Great tool.

Comment by: Bessonweb on

Very helpful ! Thanks for the tool :-)

Comment by: Bob on

Years after still rocks! Thank you!

Comment by: Jessica on

Just saved the night. I can go to bed now. Thank you!

Comment by: Looke on

God this is awesome! good job!

Comment by: hieu on

Hi, sorry for bother you. I dont know how to use it

Comment by: Some dude on

How do I force lowercase on new URL? For example, OLD URL uses a mix of upper and lower case characters, but only want lowercase. Can you maybe add checkbox to convert case or share how to change autodirect both uper and lower mix to just lower?

Comment by: Jesse G. Donat on

Presuming you're wanting to convert mix of any casing to lower case, and not a specific mixed case set, you're going to more htaccess logic than this is built to generate - using regex flags and rewritecond's.

It's out of scope of what this is meant for.

If you were interested, I offer htaccess help as a paid service. You can contact me via my contact page and we can discuss options.

Comment by: Daniel Dewhurst on

Still the best htaccess redirect generator.

Comment by: Mike on

2018 and still works like a charm!

Comment by: Jef on

excellent work!
this is the only htaccess generator worked on my case!
thanks!

Comment by: Erickson Bolivar on

OMG,You are the best, i love you

Comment by: Sasha on

Respect from Russia! Very usefull script ;)

Comment by: Dave R on

This tool is awesome! This is the only tool that solved my redirect problem.

Comment by: viktor on

Add a special character escaping in the GET parameter, some web servers cannot do without IT
RewriteCond %{QUERY_STRING} (^|&)id\=x($|&)
RewriteRule ^page\.php$ /page.php\?fid=x [L,R=301]
?fid=x -> \?fid=x

Comment by: Jesse G. Donat on

In my experience this is always something misconfigured on your server. It should not be necessary to escape the ?.

Comment by: Phil on

Hey

its possible todo this?

https://subdomain.domain.tld => https://subdomain.domain.tld/subdomainfolder?

Thank u

Comment by: Julien Gray on

Dude, you are a legend. Saved me hours. Bought you a beer!

Comment by: Bruno on

A real help! Thanks!

Comment by: Luís Brito on

A great tool! Thanks mate!

Comment by: Clay Ravin on

This tool is great, thanks making it available!

Comment by: Clay Ravin on

Or even thanks FOR making it available!

Comment by: Igor on

Супер инструмент! Очень помог. Большое спасибо автору от России!!!

Comment by: Dimitri on

Great tool!! small issue:
when redirecting to the same url than this line should be skippet, this should not be possible:

# 301 --- https://testsite.com/contact => https://testsite.com/contact
RewriteRule ^contact$ /contact? [L,R=301]

We get a lot of list with somtimes redirects that do no need redirecting. than this check would be good.

Comment by: Michel Remacle on

Thanks mate!

Comment by: Tom on

Good work! Only problem is that there's no option to decode URLs, sometimes it's needed. E.g. I copied these old and new URLs from browser address bar and pasted it in your tool. I got this:

# 301 --- a.php => b.php?filter%5B%5D=somevalue
RewriteRule ^a\.php$ /b.php?filter%5B%5D=somevalue [L,R=301]

The problem is, %5 doesn't make it to the final URL, when Apache rewrites it so this redirect is unusable. It's probably because '%' is a special character, I'm not sure. Flags B and NE don't help. Only thing that helped me was to decode that URL so I got this: b.php?filter[]=somevalue

Btw I created a similar tool http://redirectgenerator.netmagnet.cz/ :)

Comment by: Kevin on

Thank you! Worked great! I needed to do some search and replace afterward. Maybe it would be very easy for you to copy your existing code, paste it, and make another that provides the following result:


RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^colorado\-renters\-rights\-law\.html$ "https\:\/\/domain\.com\/colorado\-renters\-rights\-law\/" [R=301,L]

Thanks again! What a great tool!

Comment by: Ignacio Durán on

esta aplicación es INCREIBLE!!! GRACIAS!

Comment by: Remo on

Great tool! A handy addition in my opinion would be an option to make trailing slashes in the match optional (RewriteRule ^request_uri?/$), besides that it just works perfectly!

Comment by: Sreenivas Reddy on

Great redirection tool... It is working perfectly.

TIME-SAVING TOOL

Thank you

Comment by: Al on

Thank you for providing such a great tool. How can we handle name attribute, #abc below, at the end of a query in a link? It seems they are ignored in this tool.
text/faq.html?faq=20#abc	helpdesk/kb.php

# 301 --- text/faq.html?faq=20#Ben => helpdesk/kb.php
RewriteCond %{QUERY_STRING} (^|&)faq\=20($|&)
RewriteRule ^text/faq\.html$ /helpdesk/kb.php? [L,R=301]
I tried the following and it did not work. RewriteCond %{QUERY_STRING} (^|&)faq\=20\#Ben($|&) Any help would be greatly appreciated.

Comment by: Jesse G Donat on

The "URL fragment" - the part after the # - is not communicated to the web server and thus cannot be used as something to base redirection on.

Comment by: STEPHANE on

wow .. thanks a lot, very useful!!

Comment by: Steve on

This is just brilliant - thanks so much!

Comment by: Wannes on

What a lovely tool!

Comment by: Max on

Thank you so much!
This is the best tool! I found exactly what I was looking for

Comment by: MyGoodJob on

Спасибо тебе, дружище!

Comment by: Michael Rock on

When setting up a redirect through cPanel and it is a WordPress site it forces it to the bottom of the .htaccess files then does not work. By using your tool and manually adding it to the top of the .htaccess file it worked beautifully! Thank you! It took a while of searching to come across a tool where you can input multiple 301 redirects.

Comment by: Mike Lopez on

I have a website https://top5stories.com and i want to redirect all the post there in 1 page. Is that possible?

Comment by: s w on

Awesome tool! i HAVE JUST USED IT WITH NO FAIL!

Comment by: Michael on

You're a lifesaver. Great tool, keep it up!

Comment by: Jason Schaeffer on

Two-hundred-fifty 301s verified you are a great human. Thank you for this amazing tool!!!

Comment by: viktor on

<div class="Comment">Add a special character escaping in the GET parameter, some web servers cannot do without IT
RewriteCond %{QUERY_STRING} (^|&)id\=x($|&)
RewriteRule ^page\.php$ /page.php\?fid=x [L,R=301]
?fid=x -> \?fid=x
</dive>


<code>?</code> - it is necessary to screen since it is a special character, this is certainly not superfluous.
<code>=</code> you are screening although here it never leads to problems, the special symbol is not.
https://httpd.apache.org/docs/2.4/rewrite/intro.html

<code>?</code> on some servers you really have to screen, otherwise the redirect does not work.

According to the current description, this is a special character.

Comment by: kumar on

how to redirect all .php to / in .htaccess

example http://mywebsite.com/abc.php to http://mywebsite.com/abc/

Comment by: Ignacio on

please, put some banners in your web and I will click them all!!! love your page.

Comment by: Victor Ekpo on

THE BEST... you the you the best

Comment by: Alex on

Сайт на 20 минут к хуям отлетел, нахуй такую помощь друг))

Comment by: shambler81 on

please add
before
(^|&).....($|&)
after
(?:^|&).....(?:$|&)
this will not affect the logic in any way, but it will be convenient to count the groups

Comment by: Jesse G Donat on

Thanks for the suggestion - it was a great idea! I always end up doing it myself when writing custom rules, might as well do it off the bat. I've implemented it!

Comment by: Angelo on

Everybody thinks it's a great tool. But I think there's something wrong with it. You write in the description of the tool: "I hope someone finds this useful". That phrase is obsolete, man. Of course your tool is awesome.

You should write instead: "Check this goddamn awesome tool of mine, bro. Any comments are welcome below, ..."

Comment by: Alan on

Simple but effective. Thanks for the tool.

Comment by: Marek on

You're the best! :) Thanks!

Comment by: leandev on

Awesome, it's 2020 and im still using this :)
Definetelly saved me alot of time

Comment by: Tinny on

Thank you!

Comment by: Mar on

Okay, you're AWESOME! seriously, just discovered this in 2021. You my friend, are the real deal.

Comment by: Rick Altman on

I believe this is just what I am now looking for, ever since our ISP changed its site tools and no longer allows sites to redirect to other sites. But I am not clear on what "this" is: is it a technique for editing .htacess, or is it an actual app that I download and use?

I need a tiny bit of hand-holding to get started...

Comment by: Dave Reeder on

Thankyou so much for this, it is an amazing tool, I wouldn't be able to do some redirects without this!
The fact it can do complex urls with query strings etc. it's very impressive.

Comment by: olivia jaacob on

i want to help my website its create a various seo not friendly url, check example ? https://logodesigns.us/ its main domain, create different url https://logodesigns.us/?/mail= this type of url please help me i am waiting ? ? thanks

Comment by: Nikiforov on

Great tool, but I have one question - why the "\" character is inserted in the url? Below you can see example.

This is what I pasted to first field (old-new url):
https://www.domain.lt/old-category/subcategory/product-good-1-2 https://www.domain.lt/new-category/subcategory/product-good-1-2

This is what I get after I push “Submit Query” button:
# 301 --- https://www.domain.lt/old-category/subcategory/product-good-1-2 => https://www.domain.lt/new-category/subcategory/product-good-1-2
RewriteRule ^old\-category/subcategory/product\-good\-1\-2$ /new\-category/subcategory/product\-good\-1\-2? [L,R=301]

In the line „RewriteRule“ I see 8 characters „\“. Why? In my url no free space. You can test with my example and will get the same result. Of course I tried both variants and al lis working perfest, but questions is still. ????

Comment by: Dead support on

Dead support

Comment by: Flo on

What a livesaver tool, thank you very much!!

@Nikiforov the backslash is to mark the special character in the string, it belongs there.

Comment by: Gianluca Zamagni on

Always helpful when in a rush! Thank you ????

Comment by: ZUGEMU on

THANK you for ur contribut....
It help me lot ....

willing to buy beer for you !!!

Comment by: Vandalorian on

Not all heroes wear capes <3

Comment by: textgen.pl on

Yeah! Great tool:)

Email address will never be publicly visible.

See my Tweet about comment formatting.