.htaccess redirect with wildcards? - .htaccess

I've got a weird but into my forum in which a URL of a page changes after 1 second, without redirecting the page.
I'll explain with an example:
When someone visits my forum and edit a post, let's say he get this URL:
http://mywebsite.com/viewtopic.php?f=55&t=66&p=88#p88
where p=88 is the post number in the database.
Now, after 1 second, this url is redirected for some bugs to:
http://mywebsite.com/viewtopic.php#p88
The page is not reloaded at all, just the URL changes.
If the user tries to reload the page, he will get an error message because the link:
http://mywebsite.com/viewtopic.php#p88
is of course wrong.
So I was thinking about a solution using .htaccess in order to redirect
http://mywebsite.com/viewtopic.php?f=55&t=66&p=88#p88 (working URL)
to
http://mywebsite.com/viewtopic.php?f=55&t=66&p=88 (still working URL)
which should fix my bug.
I tried with htaccess but it seems it's harder than I thought.
My guess is i need to redirect something like this:
RedirectMatch 301 ^/viewtopic.php?f=.*$&t=.*$%p=.*S#p=.*$
but I'm not able to do it since I don't know where to redirect this. Are you guys able to help me?
Thank you so much

Related

Redirect link to id on page

I would like to make a redirect from one link to another. I mean:
I have a site:
www.mysite.com/index.php and I can do it as www.mysite.com/home, so in URL user can see home instead of ugly index.php. But... Here comes the problem... I need to make a redirect from www.mysite.com/index.php#myId to www.mysite.com/myId.
I tried a lot of things via the .htaccess file but nothing worked. Is there any way to do it?

how to redirect to the specific url through htaccess

i have a website and i want that whenever someone types in the domain it should take it to the dedicated path that i chose for it like when someone types www.gdrfa.info it should take the user to www.gdrfa.info/portal/pls/portal/ and if someone changes the url like www.gdrfa.info/portal/pls or changes anything after.info then too it should automatically redirect to my desired url can anyone tell me how can i do it i searched on web but could not find out what i wanted.
I tried
Redirect 301 "/old-page.html" "http://www.new.com/new-page.html"

QR code printed with wrong url. .htaccess redirect?

The issue is our marketing department printed the wrong QR code and the url www.batesvr.com\longcreek. Notice the . QRcode reader browser does not autocorrect the \ to a /. Is there a way in my .htaccess file to correct this issue so we don't have to reprint?
I believe it's worth trying to fix this rather than reprinting everything.
You can fix the '.' issue using the following .htaccess redirect.
RewriteEngine on
//301 Redirect
Redirect 301 /longcreek. /longcreek
Try adding this rule and check the URL. Depending on a device/browser backward-slash might be replaced with a forward-slash automatically. If not, it might be worth trying adding another redirect rule as well.
At the moment www.batesvr.com seems to be down (500 error), so if it's your real website, you might route all the traffic to the actual page. It would be a hack, but might do the trick for now.
Let me know what worked and what didn't.

Issue Regarding .htaccess Redirection

I have some issue regarding .htaccess redirection. I have checked a post regarding .htaccess redirection of one page to another domain page.
How to redirect a single web page from one domain to another using .htaccess
I have tried these code but when i use this code it is getting redirected but all the other pages on the old domain website are showing 404. Please help me.
Please note: I am not a developer and don't have any knowledge about the codes so please provide a simple solution so that i can directly implement on the website. I will be very greatful to you.....:)

.htaccess manual redirects followed by a general everything else redirect to another domain

I am trying to do a lot of manual redirects followed by a rule which will redirect everything else which isn't covered by the manual redirect.
I have already written a lot of rules following the structure shown below:
Redirect 301 /articles/1/1/1.htm http://newdomain.com/relevant-page/relevant-inner-page/
I just need to finish this off with a general redirect that will redirect all other pages not covered to the root of the new domain.
Any help or suggestions would be greatly appreciated!
I found the easiest way to do this would be to just PHP redirect in the header of the website. Works for me no problems!

Resources