Maintain URL and show a subdomain page instead - .htaccess

I have this URL I need to maintain for SEO purposes: http://vivilondra.it/servizio-taxi.html
This HTML page uses an iframe to display the content of a subdomain page: http://shop.vivilondra.it/servizio-taxi
I would delete this HTML but preserve maintain the URL in the browser.
There is any way through the htaccess to show the URL http://vivilondra.it/servizio-taxi.html showing the content of http://shop.vivilondra.it/servizio-taxi?

There is any way through the htaccess to show the URL
http://vivilondra.it/servizio-taxi.html showing the content of
http://shop.vivilondra.it/servizio-taxi?
Use mod_proxy in combination with mod_rewrite via the P flag.
RewriteEngine on
RewriteRule ^(.+)\.html http://shop.vivilondra.it/$1 [P]

Related

how to rewrite joomla pagination to friendly url with htaccess

I want to rewrite pagination URLs http://mydomain.com/category?start=15 to http://mydomain.com/category/start/15, but I don't know how to achieve this with .htaccess.
PS: those URls ( http://mydomain.com/category?start=15) are referenced in search engines so I need to add 301 redirect to my new URLs.
I want mention that I already enabled SEF mode in Jommla configuration
First, if you want your URLs to look like /start/15 you have to rewrite them from the pretty format to the internal, not otherwise.
I currently have no access to an Apache, but your expression should look something simliar to this:
RewriteRule ^category/start/([0-9]+)$ http://mydomain.com/category?start=$1 [QSA,L]
Then, it would be neccesary to tell Joomla how to generate the pretty URLs, this happens without the htaccess file, for example in a SEO plugin.
Finally, to output 301 messages, you will want to add "Redirect" commands to your .htaccess file. Redirect incoming ?start=15 URLs to the pretty format. Make sure that this does not happen after your Rewrite...

.htaccess invisible redirect to page within subfolder

I've tried many options in .htaccess without success. What I want to do is this:
I have Wordpress residing in its own folder, like this: site.com/folder
I want all users visiting site.com to be redirected to site.com/folder/page but in such a way that the URL doesn't change in the browser. All other URLs, such as site.com/folder and site.com/folder/page1 etc shouldn't be affected.
How to do this, in as SEO-friendly way as possible?
Thanks everyone.
You can't redirect a user to a other page from serverside without to show this to the use.
But if you need, you can use the HTML tag <frame> http://www.w3schools.com/tags/tag_frame.asp
But the bad side with this is the use always will be show "site.com" and not the real page.
But I think the best way is to proxy the result, in Apache you can do this by something like this.
RewriteEngine ON
RewriteRule ^/$ folder/page/index.php [L]

Going extensionless with redirection

My site has more than 500 dynamic pages and i have make all static (same) pages and redirect old url or new url by using the following rule in htaccess file:
RewriteCond %{QUERY_STRING} ^cid=2&gas=nitrogen$
RewriteRule ^purity\.php$ http://Example.com/gases/nitrogen.php? [R=301,L]
and by using this code for all my pages are now static url's
and now i want to make it http://www.Example.com/gases/nitrogen (without extension) and for this i have uploaded the rule which is :
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^\ ]+)\.php\ [NC]
RewriteRule ^ /%1 [R=301]
This code is actually redirecting my php page to non php page but with 404 error.
Im unable to figure out the problem in this.
Pls help!!
There is a problem with what you are trying to do. You have to understand how rewrites work. You're making your webserver serve up a different page that doesn't exist. So by sending an ugly url to a better SEO'd one, you're saying ok server give me this page instead. If the page itself doesn't exist, then the server spits up a 404 error. Your rewrite should be from the page you want them to go to redirects to your old page name without the [R] parameter so your server knows, don't give this page, give that other page, and don't let them know it's being done by displaying that other url, that's what removing the [R] does. Then to prevent the endless redirect loop, don't redirect the ugly page name to the new one. Instead, simply display the redirected url instead of the ugly one with all those ugly looking parameters. however since you've probably already been indexed and search engines know about the ugly pages, I would recommend not only not linking to those pages anymore and use the new page names on all your pages for things like navigation, and referencing other pages, but I would add the canonical meta tag on your pages telling Google and other search engines what your preferred url is. If you had started out without any search engines knowing your url structure with all those parameters you could have skipped using the canonical meta tag as the search engines wouldn't know your pages by those names if you always used a rewrite.

How to remove part of URL .htaccess - Magento

I need to remove the last two sections [/../..] of any URL requests that include [/desc/name-of-product] via .htaccess.
Example:
[www.domain.com/product.php/id/10101/desc/apple-laptop-computer] ->
[www.domain.com/product.php/id/10101]
[www.domain.com/product.php/id/985/desc/hp-computer] ->
[www.domain.com/product.php/id/985]
I am working on a Magento site that currently redirects old URLs (Example: www.domain.com/product.php/id/10101 to the new Magento URL www.domain.com/product-name via the URL Rewrite Management tool in Magento. The problem is the old domain was allowing Google to crawl two URLs for the same product in the examples above.
Since Magento is rewriting the shorter URL in the example above properly, I need a rewrite rule to remove the last two sections [/desc/name-of-product] of any incoming links that have a [/desc/*] section.
RewriteEngine on
RewriteBase /
RewriteRule ^/product.php/id/(\d+)/desc/[^/]+$ /product.php/id/$1 [R=301]
This will do an HTTP 301 redirect to your new URL, so Google will be informed that the page has moved permanently.
More informations on the Apache rewrite mod
List of HTTP status codes

Rewrite rules to hide an url

i need to hide full path and show shortly:
www.site.com/this/is/path/to/hide/page.php --> www.site.com
Any idea to do it with .htaccess apache and rewrite rules??
EXAMPLE:
If i type www.site.com i want open index.php (in /),
but if i go to /hidden/path i want to open file.php (in hidden/path)
mantaining browser url in www.site.com.
EDIT:
i want to see in the browser bar www.site.com and i want to open page at /this/is/path/to/hide/page.php .
thanks
As I explained in : How does url rewrite works? every rewrite triggers a new call to the rewritten URL. (HTTP 3xx code).
So the client will ask for www.site.com/this/is/path/to/hide/page.php, would be redirected to www.site.com and will be served the index page as a normal user.
There is no way to tell the client to display one URL in the browser bar instead of another, client browser will always make a new request. (Or you could impersonate any site for example)
If you are not against the use of a cookie, or can use environment variable you may be able to do something like :
RewriteRule this/is/path/to/hide/page.php / [co:knowHiddenPath=true]
The environment variable as same syntax with E instead of co.
(See http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html for cookie information)
Your index page should then check this cookie/variable to serve the hidden page or not.
Another solution would be to enable access with password to your file. So even if someone know the URL he would not access the file. Security by obscurity is does not exists.
You can I believe do that with an Alias,
Alias / /this/is/path/to/hide/page.php
This directive needs to be in your <VirtualHost>
This will use mod_rewrite and you can put this into your .htaccess
# Activate Rewrite Engine
RewriteEngine On
# Home page rewrite rule
RewriteRule ^$ /this/is/path/to/hide/page.php [QSA,L]
This will ONLY work if you hit website root (e.g. http://www.example.com/)

Resources