Redirect to new URL`s - apache

i want Redirect the old url`s to new address.
Redirect all
http://www.mysite.com/viewdownload/**/**
url`s to
http://www.mysite.com/download/viewdownload/**/**
example:
http://www.mysite.com/viewdownload/21/323
Should be Redirect to
http://www.mysite.com/download/viewdownload/21/323
or
http://www.mysite.com/viewdownload/13/961
Should be Redirect to
http://www.mysite.com/download/viewdownload/13/961

RewriteRule ^(viewdownload)/(\d+)/(\d+)/?$ download/$1/$2/$3 [L,R=302,QSA]
If this does what you'd like it to after some testing, change R=302 to R=301.

If you are using Apache this is something for mod_rewrite / url rewriting & not Joomla.
You got the wrong keywords. Search for mod_rewrite or come back if you need more help.

Related

Custom .htaccess hidden 301 redirect

Is it possible to write in one rule the redirecting for each brand alias to an equivalent get-parameter?
For example:
"/katalog/protein/api/" must be redirected to "/katalog/protein/?ms|manufacturer=API",
"/katalog/protein/activelab/" must be redirected to "/katalog/protein/?ms|manufacturer=ActiveLab"
I'm looking for something like that in .htaccess:
RewriteRule ^katalog/(protein|gainer)/(api==API|activelab==ActiveLab)/?$ /katalog/$1/?ms|manufacturer=$2 [R=301,L,QSA,NE,NC]
Is it possible? Thank's for any help.

Apache mod_rewrite

I'm using Liferay 6.2 EE that runs on tomcat but it's fronted by an Apache server. I want to redirect users so that whenever they hit the old liferay URL, it redirects them to the new liferay URL. I changed the URL in liferay, so it is now the new URL. However, whenever I try to go to the old URL, I get a page request error. It never redirects me to the new URL. In /san/apache/conf/ I put my redirect code inside of httpd.conf. This my code:
RewriteEngine On
RewriteRule ^group/old/(.*) /group/new/$1 [L]
After I applied these changes, I restarted the Apache server and it still doesn't work. I've tried a bunch of other combinations as well. Does anyone know what I'm doing wrong? Is there some place else I have to make this change?
Ah, since your rewrite rule is lying in the server config file (instead of htaccess file), the mod-rewrite receives URLs with the leading slashes (/). So, the rule should be:
RewriteEngine On
RewriteRule ^/group/old/(.*) /group/new/$1 [L]

Apache Rewrite keeping the original QueryString on the Rewrite URL

I have a problem.
The follow code is my Apache configuration:
RewriteRule ^/page-(.*)$ https://%{SERVER_NAME}:%{SERVER_PORT}/site/spaces/portal/page/$1 [QSA]
So, its OK. But, when I access my page like:
www.mysite.com/page-page?query=blah
It redirects the URL without the query=blah params.
What I'm doing wrong?
Thanks
I am not sure why they are missing, but you should be able to put them back with %{QUER­Y_S­TRING}.

mod_rewrite to redirect url not working

Cannot seem to get a mod_rewrite to work. We have a domain name that has already been printed here, there and everywhere when the website was Flash. It has a # in its trail /#login.php and we want so that when people put this in it redirects them to /login.php. I have already tried this rule but can't get it to work:
RewriteEngine On
RewriteRule ^/#login.php$ /login.php
I have also checked that the rewrite engine is working by using a redirect to google. Just need the out of date #login.php to go to the new login.php
thanks
The # in the URL (or "fragment") is not sent to the server, it's purely for the client side to point to some part of the page. If you see http://hostname.com/#login.php in your address bar, the only thing the server gets is a request for /. You may need to employ some javascript on the page to look at the browser's address bar to find a fragment and maybe send that to the server as a query string.
Try :
RewriteEngine On
RewriteBase /
RewriteRule ^#login\.php$ /login.php [QSA,L]
Mod_rewrite is enabled ? available ?

mod_rewrite Internal rewrite with the new URL showing

I am using Mod_Rewrite to rewrite (internal) some old pages to new pages on my site.
This works:
RewriteRule ^thispage\.html$ thatpage.html
The problem is that the page changes to the new page (this is good!), but does not change the (URL) name from "thispage" to "thatpage" so the user gets hinted to the new address. Apache (2.x) states to place a [R] after the above script, i.e.,
RewriteRule ^thispage\.html$ thatpage.html [R]
This supposedly lets the user know it is changed and sends them to the new page.
When I add the [R], I get a 500 error. The server is an Apache/1.3.33.
I am thinking that the only way to force the server to show the new url is to use a redirect instead on rewrite. Any ideas?
Any help is sincerely appreciated!
Have you tried this?
RewriteRule ^thispage.html$ thatpage.html [R=301,L]
Alternatively, a Redirect would be easier on the server than a Rewrite...
Redirect 301 thispage.html http://yourDomain.com/thatpage.html
For not display new url, you must delete [R], because
[R] is for display new url