Removing "feed" folder in htaccess - .htaccess

I've looked everywhere and cannot figure this out and appreciate anyone's help on this:
I have several links that need to be redirected and they look like this:
http://www.DOMAINNAME.com/about-us/feed
I just want to remove the folder "/feed" in those URLs and everything I have tried doesn't work:
RewriteRule ^about-us/feed$ http://www.DOMAINNAME.com/about-us [R=301,L]
Also does not work:
redirect 301 about-us/feed http://www.DOMAINNAME.com/about-us
Thanks again for the help. I have a LOT of other redirects to do but will start here. I normally don't have any issues with these but for whatever reason these are causing me some issues. Plus it's Monday so I'm sure that doesn't help any :)

Related

How to rewrite directories into query string

Yay, my first Stackoverflow question ever! Been around for years but this one gets me.
I have an URL:
https://example.com/site.com/phpBB3/general-f1/things-are-getting-crazy-here-t948-60.html
(I need to test this locally first which is why I have set it this way)
I want to change the URL into:
https://example.com/site.com/phpBB3/viewtopic.php?f=1&t=948&start=60
I have my .htaccess file in /example.com/.htaccess and the content is:
RewriteEngine On
RewriteRule ([a-z0-9_-]*-f)([0-9]+)\/([a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ viewtopic.php?f=$2&t=$4&start=$6 [QSA,NE,L,NC]
I have AllowOverRide set and the rewrite mod is enabled.
This seems to work in https://htaccess.madewithlove.be/
but not at the actual site. I'm going crazy. What's wrong with me?
This helped me to solve my problem https://techtitbits.com/2008/10/phpbb-redirect-broken-links-after-uninstalling-an-seo-mod/

htaccess: rewrite to optional amount of "subfolders" www.xyz.com/a/b/c/d

sorry for my bad english and wrong use of technical terms.
So I got these links on my site:
www.xyz.com/index.php?link=abc
I want to rewrite via htaccess like this:
www.xyz.com/def/.../jki/abc
/.../ meaning that I want to be able to be as flexible with my "link-design" as I want.
I tried it this way:
RewriteRule ^.+/([a-z-.-?]+) index.php?link=$1 [NC,L]
and it works, but the strange part is, that it doesnt work all the time, or it totally stops working. Sometimes images and css is not being loaded anymore.
Then I switched to test it with
RewriteRule ^.+/m/([a-z-.-?]+) index.php?link=$1 [NC,L]
and this works fine, but I'm abviously stuck with the /m/-part like:
www.xyz.com/def/.../jki/m/abc
Is there even any option to do this?
Thank you very much.

.htaccess rewriterule problems

I need a few redirects in my .htaccess file, and what I've done works perfectly well in the htaccess tester, but it doesn't work at all on my server. I've spent days finding a solution, and I'm stuck. It would be wonderful if someone could help!
1) "/-" in URLs
This is a good example:
https://www.haraldjoergens.com/galleries/remembrance-sunday/2012-cenotaph/-march-past/index.php?page=40
The "2012-cenotaph/-march-past" is supposed to be "2012-cenotaph-march-past"
I had though a straightforward RewriteRule ^(.*)/-(.*)$ %1-%2 [R=301,L] would do the trick, but it seems to be completely ignored.
2) Repetition needs to be removed:
Due to making the "Replace" a 301 replace too early, the search engine bots try to access very wrong things:
https://www.haraldjoergens.com/galleries/rowing/index.php/galleries/rowing/
The second "/galleries/rowing" needs to be removed. My attempt via
RewriteRule ^(.+/index\.php)/.*$ /$1 [R,L]
works fine in htaccess tester, but seems to send the website into an endless loop.
Any suggestions would be really appreciated!
Thanks!!!
Harald
htaccess example
I dont know if this is what you really need.
One thing helps me is to change the routes for example:
$route['index.php/galleries/rowing/'] = "index.php";

htaccess file help needed for rewriting url

I need help from experts to solve my problem. I'm just starting to learn rewriterule, rbase, and rcond. I want to rewrite my site link like codeigniter MVC. For example:
http://localhost/app/index.php?page=profile&user=john -> http://localhost/app/index/page/profile/user/john
How to do that? I tried to change for many times, but i don't get url like that but error occured.
RewriteRule ^index/page/(.*)/user/(.*)$ /index.php?page=$1&user=$2 [L]

Looking for answer about Clean URLs that I have not found thus far

I am looking to clean up my URLs and I am having the most difficult time. I have an Apache server on GoDaddy. Not sure if hosting is the problem. I've uploaded many .htaccess files and none have worked.
Goal: I am trying to eliminate ".php" completely from my site.
Example: http://example.com/about.php and http://example.com/folder/anotherpage.php
I want it to read http://example.com/about and http://example.com/folder/anotherpage
How do I write a .htaccess file for this? All of the answers I've found deal more with parameters.
and nothing I've done seems to work. Is this a GoDaddy issue? Please help. Thanks in advance.
I think it should be as follows:
RewriteEngine On
RewriteRule about about.php
RewriteRule folder/anotherpage folder/anotherpage.php

Resources