Using .htaccess to clean up some dynamically generated URLs - .htaccess

Hi there I have been looking through some of the posted answers on how to do this and I am coming up a bit lost. Some of the posts I have read are as follows:
Rewrite search page query URL with htaccess
What does RewriteBase do and how to use it?
What does $1 [QSA,L] mean in my .htaccess file?
Pretty URLs for search pages
The URLs we have currently look something like this:
example.com/search/?itemID=I-123456&itemName=FirstItemName+SecondItemName+MoreItemNames
I would like them to read something more towards this:
example.com/search/FirstItemName/SecondItemName/MoreItemNames/
Any guidance would be greatly appreciated. Thanks!

Related

.htaccess URL rewrite rules

I'm trying to learn how to rewrite URL's within htaccess files.
If anyone can give me some good links that would be brilliant.
I'm trying to aim to rewrite this:
http://www.domainname.co.uk/news/newsSingle.php?ID=9
to this:
http://www.domainname.co.uk/news/category-name/post-name.php
I have the category-name & post-name within the database for each matching ID.
Any help would be great thanks!
you can take a look at
9lessons.info
Media Temple
Stack Overflow .htaccess
Hope these help you find the answer.

htaccess URL overwrite - Magento

I have some URLs that I would need to overwrite so that if someone looks at the source code they can't actually see the real URLs for the product images in Magento. Currently, the link is as
externalsub.domain.com/images/image123.jpg
I want to make it as
mydomain.com/images/image123.jpg
How can I achieve this via .htaccess? Any help is much appreciated!
Then in an htaccess file, you can use this (above whatever rules you may already have):
RewriteEngine On
RewriteRule ^images/([^/]+\.(?:jpe?g|png|gif))$ http://externalsub.domain.com/images/$1 [L,P]
You don't need the line turning on the rewrite engine if you already have that (only needs to be in your file once).

.htaccess to change the url path

I have tried several examples of solutions that I have found here on StackOverflow but none of them seem to work correctly.
I have a Magento store that I need to redirect an old store code url to the new one. For example:
The old url looked like this.
www.example.com/something_en
In the above example I need to be able to modify any url that contains to the path something_en and change it to something like in the next example.
www.example.com/something
Any help is much appreciated.
Make sure this is your very first rule in main .htaccess:
RewriteEngine On
RewriteRule ^something_en(/.*)?$ /something$1 [L,NC,R=301]

Creating Google Friendly Folders

Basically I'm trying to figure out a way to make
http://www.mysite.com/check/google.com
show the contents of the page
http://www.mysite.com/check.php?site=test.com
and I want users to think that the actual URL is http://www.mysite.com/check/google.com instead of the long one.
But I need to do this in the friendliest way for Google so that they aren't looking at it as a redirect and it'll still rank well... Any help will be greatly appreciated if you can post some sample code... Thanks!
In the htaccess file in your document root, try adding:
RewriteEngine On
RewriteRule ^/?check/(.*)$ /check.php?site=$1 [L]

Why can't I make my URLs rewrite in my htaccess file?

I've been messing with this for the last hour... visiting about 20 different Google tuts and I can't seem make my site rewrite the url in any way. I've even just tried changing .php to .html and I'm not having any luck.
Here's one of my many fails:
RewriteEngine on
RewriteRule viewItem(.*)\.htm$ /viewItem.php?id=$1
For this above one, I'm just trying to change my viewItem.php page to viewItem.html
My ultimate goal is to change hxxp://mydomain.com/viewItem.php?id=900 (as one example of an id) to hxxp://mydomain.com/details/
I'm then going to append the title on the end. I can do the append in php but being a newb to .htaccess, I'm apparently missing something glaringly obvious.
Any ideas?
Thanks much.
Did you miss the 'l' of 'html'?
RewriteRule viewItem(.*)\.html?$ /viewItem.php?id=$1

Resources