I have this url:
http://www.mysite.com/pronostici/data/2012/aprile-2012/7216-prono-02-04-2012
I have redirect to
http://www.mysite.com/pronostici/data_incontri/2012-04-02
How would I go about doing this in .htaccess?
Thanks
If I understand correctly your source URL, you can use the date at the end to build your target URL. So, something like this should work:
RewriteEngine On
RewriteRule pronostici/data/.*/\d+-prono-(\d+)-(\d+)-(\d+)$ http://www.mysite.com/pronostici/data_incontri/$3-$2-$1 [R=301,L]
Related
I have the following URL:
https://www.parcelparcel.com/nl_NL/pakket-versturen-frankrijk/?page=nl_NL/populair/pakket-naar-frankrijk/
Which I would like to 301 redirect to:
https://www.parcelparcel.com/nl_NL/pakket-versturen-frankrijk/
I tried to pull this off with the following code in my .htaccess:
RewriteRule ^index.php/populair/pakket-naar-frankrijk/?page=nl_NL/populair/pakket-naar-frankrijk/?$ https://www.parcelparcel.com/nl_NL/pakket-versturen-frankrijk/ [R=301,L]
However, without results. Can anybody advice me or tell me what I'm missing. I checked if the URL is redirected in incognito.
Thanks in advance!
Try This:
RewriteCond %{QUERY_STRING} !^(.*)$
RewriteRule ^nl_NL/pakket-versturen-frankrijk/?$ nl_NL/pakket-versturen-frankrijk/?page=nl_NL/populair/pakket-naar-frankrijk/ [L]
Fisrt line to exclude a request that has Query String
The second to choose a URI that starts with nl_NL/pakket-versturen-frankrijk/ or nl_NL/pakket-versturen-frankrijk and redirect it internally to nl_NL/pakket-versturen-frankrijk/?page=nl_NL/populair/pakket-naar-frankrijk/
I was wondering how it is possible to remove part of a url with htaccess for example I have a url like this:
http://localhost/item.php?pa=gd34392
now I need to use htaccess to redirect this page or anything like this to a page with this url:
http://localhost/gd34392
I have tried things like this but nothing seems to work and I do not really know my way around htaccess
RewriteEngine on
RewriteRule item.php?pa=$1 /$1 [R=301,L]
You can achieve that using the following rules in your .htaccess:
RewriteEngine On
RewriteRule ^([^/]*)$ /item.php?pa=$1 [L]
Just make sure you clear your cache before testing this.
I was wondering if I could get some help changing a URL.
I would like to change and match all city/state URL's to a different format and have them redirect to the newer URL if someone lands on them.
I would like to change and redirect:
http://www.domain.com/FL/Miami.html
to
http://www.domain.com/miami-fl/
The rule I have right now that I would like to change and redirect to new one:
RewriteEngine On
RewriteRule ^(.*)/(.*)\.html$ index.php?st=$1&city=$2 [L]
As long as the case doesn't matter, you can just do this:
RewriteEngine On
RewriteRule ^(.+)-([^/-]+)\.html$ index.php?st=$2&city=$1 [L]
I need to redirect a dynamic url to another url, with the dynamic portion intact, for example:
http://www.mydomain.com/VARHome.aspx?var=32
needs to redirect to:
To: http://www.otherdomain.com/VARHome.aspx?var=32
The value after "var=" is dynamic, it can be any number.
This needs to be done via .htaccess.
Thanks for any help!
I'm thinking RewriteRule ^(.*)$ http://www.otherdomain.com/$1 [R=301,L] or something along those lines should do the job.
Edit: Maybe something like
RewriteRule ^VARHome.aspx?var=(.*)?$ http://www.otherdomain.org/VARHome.aspx?var=$1/ [R=301,L]
if you are in mydomain.com, write in .htaccess
RewriteEngine on
RedirectMatch 301 ^/VARHome.aspx?var=(.*)$ http://www.otherdomain.com/VARHome.aspx?var=$1
I want to rewrite a URL through htaccess, but I am not getting the solution to do the specific rewriting. For e.g., I have a URL:
http://www.yourdomain.com/page/about-us.html
Now I want to remove page from above URL, so it should look like;
http://www.yourdomain.com/about-us.html
Can anybody help me with this.
Thanks in advance.
Something like this should work:
RewriteEngine on
RewriteRule ^about-us.html$ /page/about-us.html
If you need it done on any URL put into the site, then something like this:
RewriteEngine on
RewriteRule ^([_\&\'\,\+A-Za-z0-9-]+).html$ /page/$1.html
Assuming you want a 301:
RewriteEngine on
RewriteRule ^page/about-us.html$ /about.html [R=301,L]