Redirect a specific single web page from one domain to a specific web page under another domain - apache

How do I get the following redirect to work?
The old address contains URL parameters:
olddomain.com/Index.asp?CategoryID=2379&ArticleID=6592
And needed to redirect to a regular URL under the new domain:
newdomain.com/example-page
Can I do it via mod_rewrite on on my .htaccess file? what is the correct command for this redirection?
I will need to do that for each page under the old domain (the target URL under the new domain will be different for each page)

Actually nothing, the only solution I found was to redirect the entire domain to the new domain, without redirecting each page to it's target.

Related

resolve URL domain with external subdomain contents

I've purchased a new domain, lets call it example.ca.
I need the above URL to resolve in the browser, with the contents of another site, in this case www.test.ca/othersite
The expected behaviour is so when a user types example.ca, the site will load the contents of the www.test.ca/othersite, while still appearing the above URL as example.ca
I am not looking for a redirect, so wondering how this can be done using DNS and apache rules. Any help is appreciated!

Redirect all subsites to one site

I have a website running on Apache. The address is http://helpdesk.example.com/otrs/customer.pl
I would like to create a forward such that if I access http://helpdesk.example.com/otrs/anyname (except customer.pl) this redirects to http://helpdesk.example.com/otrs/customer.pl
Also I'd like to not show the path of the website in the URL:
http://helpdesk.example.com/otrs/customer.pl displayed as http://helpdesk.example.com/
Thanks you for help!

redirect directory to new address

hi i want redirect my directory to new address and remove .html ext from end
example:
http://www.mysite.com/viewdownload/11-e/652-elena-2010.html
redirect to
http://www.mysite.com/download/viewdownload/11-e/652-elena-2010
or
http://www.mysite.com/viewdownload/9-b/1281-birdsong-2012.html
redirect to
http://www.mysite.com/download/viewdownload/9-b/1281-birdsong-2012
Assuming mod_rewrite is installed, just use URL rewriting in your .htaccess files. You can use URL rewriting to redirect users as well as doing an internal transfer.
A good reference is here: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
Note that if there is any custom logic to mapping your old URIs to your new ones you might want to rewrite the old URIs to a PHP script which then returns the needed file.

rewrite url without change address

I want to show a page instead of another page, without change the second page url.
I know this is possible with htaccess.
I copied that code from a cms htaccess:
RewriteRule ^event-([0-9]+)\.html$ calendar.php?action=event&eid=$1 [L,QSA]
with that code, we will redirect to calendar.php?......... but I want it redirect (without changing the address in address bar) to another site, for example to http://www.google.com/page......
Is it possible?
Thanks ..
If you want to provide content from another site without changing the address in the address bar of the browser that mean you becomes a proxy.
So check apache documention for proxy configuration (this can be done for specific urls only). Even mod_rewrite can do the proxy things with the [P] tag, mod_rewrite will allow a lot more 'specific url' filtering.
Now the job of a proxy, when he have the response from the distant website and he needs to render it for the HTTP client, is only to change the HTTP headers in the response. So only url in Location tags or such specific headers will be altered. You must known that all the HTML content from the distant website will not be altered (the inner links will be on www.google.com and not on your www.whythehelldoiproxygooglewithmysite.com).
If you want to alter this returned content check mod_proxy_html module, this will add some extra stuff before sending the resonse, to do some more reverse proxy alterations.

I want all page requests to point to a single page

The wrinkle is that the pages being requested are aspx pages and they are no longer present. I want any request coming to the root domain (and any subdomain like www) to redirect to a single page in the root directory (namely index.html) I went into the IIS admin tool, selected the domain and tried to direct to a url (http://mydomain.com/index.html) but that caused index.html to be appended multiple times and resulted in an error.
What is the best way to do this, so that any http request ot hsi domain goes to the index.html page?
Thanks in advance.
Warren
You can achieve this using the ASP.Net App_Offline feature; if you place a file in the root of your website called App_Offline.htm, the contents of that file will be returned in response to all incoming requests.
Or find your default 404.html file and put some redirection code into it