Redirect url containing string to same url without string - redirect

I need to redirect my addresses from a website to another one.
My current urls are like this:
mysite.com/test/.../.../...
or www.mysite.com/test/...//...//
so I need to redirect all of my pages to mysite.com/.../.../... or www.mysite.com/.../... so actually I need to redirect to the same url but without the test/.
Any ideas on doing it preferably via .htaccess?
Thank you in advance

redirect from root folder yoursite.com/...//...
https://www.redhat.com/sysadmin/beginners-guide-redirects-htaccess

Related

.htaccess 301 redirect with trailing ? in URL

any assistance on this redirect question is appreciated. I am adding several redirects from an old url to new pages on a website. Several of the old urls that are indexed have a trailing ? in the url. www.example.com/products/1234?
I have the following redirect in place that does not work
Redirect 301 /products/1234? http://www.example.com/test/
If I remove the question mark above the redirect does work, however it then adds in a question mark to the url it's redirecting to. http://www.example.com/test/?
How do I get this to redirect without it displaying a ? in the URL?

Opencart Url redirect

I made a custom registration module for Opencart,
my registration page has the following url:
www.mysite.com/index.php?route=account/customregister
while the default registration page url is:
www.mysite.com/index.php?route=account/register
I want to redirect users to my registration page (route=account/customregister) when users click on any link that points to the default registration module(route=account/register). I know I can edit the .htaccess file to make a redirect or a url rewriting but I want to do that by php. Do someone knows if there is some class/function or some kind of code I can put on my extension to automatically redirect users to the new url?
Thanks all in advance
P.s.
I cannot modify the core files and I would not edit the .htaccess.
This can be achieved with a vQmod pretty easily. You need to use a vQmod to edit the file /catalog/controller/account/register.php and put
$this->redirect($this->url->link('account/customregister', '', 'SSL'));
just inside the index() method declaration (so use this as the search for the vQmod and use the after position)
You can redirect from homepage to any product by adding this code in:
catalog/controller/common/home.php
$this->response->redirect($this->url->link('product/product', 'product_id=50', ''));
Where 50 is your product id. This is on Opencart 2.0.1.1. I did this because I only sell one product, hope this helps.
for redirection this may also work in opencart
$this->redirect($this->url->link('account/customregister', '', 'SSL'));

Redirecting users to the facebook app

If I have an app on facebook that's pulling the content from http://example.com for instance, is there a way I can stop people visting the example.com site and instead redirect them to the facebook app page?
Facebook is sending a POST variable called signed_request when the page is opened within a Fan Page Tab or the Canvas page of your App. Simply check if the POST variable is there and redirect to your App's Canvas page if not ;-)
Here you can read a bit how the signed_request is used inside an App.
Kalvin is close. Props to Kalvin :)
Setup your website to default to index.html
Move the real content of your site from index.html to index-fb.html
In index.html then place either the meta tag for redirection or just javascript for location.href='' script for redirection. The url to redirect to will be in the https://apps.facebook.com/{yourappname} format.
In facebook, update the app settings canvas app url from http://example.com to http://example.com/index-fb.html
1) Pull your content from your website from a subfolder
2) Redirect them from the index.html using a meta tag:
http://www.web-source.net/html_redirect.htm
A better way would be to check if the content is being displayed inside facebook and then redirect but I have no idea how to do that
Edit the .htaccess or conf.d file on your Apache web server (or the rewrite rules in IIS) to give a 301 Permenant Redirect.
Assuming you have Apache:
1.) Log into the box using ssh or some terminal emmulation program
2.) cd /etc/httpd/conf.d
3.) Locate the the configuration file for your site, edit it using vi, emacs, nano, or some text editor
4.) See here on how to write the rewrite rule.

Redirect to a specific page on a DNN site with an extensionless URL

I have a page on my DotNetNuke site and I would like to set up a redirect and was wondering the best way to do it. Here is the problem:
I have a page on the site: mydomain.com/dashbaord.aspx. I would like users to be able to type mydomain.com/dashboard OR mydomain.com/Dashboard and it will redirect them to the /dashboard.aspx page.
I have IIS6, so I set up wildcard mapping, and it seemed to work for /dashboard, but not /Dashboard. Also, I am looking for it to literally redirect you so that /dashbaord.aspx shows up in the address bar. In addition, the wildcard mapping broke some other links on the site, so I was looking for an alternative method to accomplish this. Is there a way that I can set this up through IIS? Or any other way?
Thanks in advance for the help.
In IIS, create a virtual directory by right clicking on Sites, and then call it Dashboard. Then set that to redirect to a specific URL, in your case, http://mydomain.com/dashboard.aspx.

redirect wordpress calls to a page

I'm not really sure what is the best way to do this. Say you have set up a page like so:
www.myblog.com/page1
Is it possible to, specify that the request to any of the subpages under page1 be redirected to a single page? Say if I had page1.php as one of my pages, any URL that is prefixed with:
www.myblog.com/page1/...
wordpress would use that file to generate the page.
Basically, I have some custom content that I want fetched with php, and it depends on which subpage is being loaded. The format of the custom content is always the same, only the 'arguments' differ. Is there a way to do this within Wordpress? And if not, where should I should I start looking to implement this?
Thanks
try modifying .htaccess file and rewriting url so all requests for /page1/page2 will be rewrite to /page1=?page=page2 or something like that