SEO - Will this url rewriting index particular image? - .htaccess

Example, if I have URL to particular image like (which doesn't exist on server):
domain.com/news/12/imgname.jpg
and i need to generate it on the fly and display it to the end user, i'll use some htaccess to rewrite previous url to:
domain.com/image.php?img=12/imgname
My question is: Will image imgname.jpg be indexed by the search engines (image.php in this case will return always the same image generated on the fly)?

Related

hide (:any) from url using htaccess

I am using CodeIgniter. I want to hide the last segment from the URL. My URL is given below:
http://localhost/metropolitan/admin/home/1
I create this URL using "routes.php:, which looks like this:
$route['home/(:any)'] = 'home/content/$1';
Can anyone tell me how I can hide the last segment from the URL? Is there any method using the ".htaccess" file?

RewriteRule - redirect multi variable URL to multi variable URL

Our old website has a search URL structure like this:
example.com/Country/United States/Region/California/Area/Southern California/City/San Diego/Suburb/South Park/Type/House/Bedrooms/4/Bathrooms/3/
This is currently rewritten to point to the physical page:
/search/index.aspx
The parameters in the URL can be mixed up in different orders, and the URL can include one or more parameters.
We want to 301 redirect these old URLs to a new structure that is ordered in a logical way and more concise:
example.com/united-states/california/southern-california/san-diego/south-park/?type=house&bedrooms=4&bathrooms=3
example.com/united-states/california/?type=house&bedrooms=4&bathrooms=3
Is there a way with URL rewriting to interrogate the old URL, work out what parameters are existing and then write out the new URL structure?
Even if we can limit it to just the Country, Region, Area, City and Suburb, that may be good enough to at least return some results even if it's not perfect.
Also, spaces should be turned into hyphens and all text made lowercase.
I already have the RewriteRule to turn the new URL structure into a URL to point to a physical page. It's just transforming the old URL in to the new URL I need help with. I've googled endlessly and it's just beyond me!
Can anyone help? Thanks.
Since you already have the old search page with rewriting rules set up for it and which is capable of parsing all parameters you need, the easiest and most appropriate solution I see here is to issue a redirect you require from this old search page's code. Just put the code that composes new URL with all parameters needed and redirects from this page - this should be a lot easier than trying to parse all these parameters in .htaccess and combine them into the new format.

IIS Search Engine Optimization and Canonical Url with Dynamic Image

I get the following error below for my dynamic image generator. It can have any kind of width or height but SEO is complaining about it because it needs a canonical URL. How can I do this with a dynamic image that isnt a page?
The page with URL "http://localhost/assets/images/99?w=125" can also be accessed by using URL "http://localhost/assets/images/99?w=100".
Search engines identify unique pages by using URLs. When a single page can be accessed by using any one of multiple URLs, a search engine assumes that there are multiple unique pages. Use a single URL to reference a page to prevent dilution of page relevance. You can prevent dilution by following a standard URL format.
The canonical URL can be specified in a HTTP header, too. See RFC 6596, section 4:
or alternatively, in the HTTP header field as specified in Section 5 of [RFC5988]:
Link: <http://www.example.com/page.php?item=purse>; rel="canonical"

URL rewrite image links

I have third party sites that link to some images on my site. The images were placed in Magento's image cache some time ago. But when the cache is refreshed, Magento modifies the file names and thus the links become unreachable. It is not every image just certain ones that this is happening to. I have 22 images where I need to do this.
How can I modify my .htaccess to make the links go to a static copy of the image located in another directory?
Take a look at mod_alias and RedirectMatch, you can use regular expressions to match against a URI and a target (where to redirect to), if you don't need regular expressions, you can just use Redirect.
RedirectMatch /old_image_uri /new_image_uri

Creating canonical search result URLs with mod-rewrite

I have a search engine on my site with two search parameters, location and query. I want to show the results on a page with the canonical URL of /search/location/query.
I tried aiming the search at a non-existant PHP file which I could then rewrite using my .htaccess:
# search bar rewrites
RewriteRule ^search.php?query=([A-Za-z_-]+)&location=([A-Za-z_-]+)$ /search/$1/$2/ [R]
This doesn't seem to be working, however, and after setting my search form to post GET to search.php I just get a 404. I would prefer not to have to use Javascript to submit the form directly to the canonical url - any way I can rewrite it dynamically with mod rewrite?
Wouldn't the better approach be to change the form from a get to post?
Generally pretty URIs are for actual locations rather than search results.

Resources