.htaccess rewrite help request - .htaccess

I am hoping to gain some help with a small trouble I am experiencing with configuring a .htaccess file. Basically, I want to retrieve 2 variables from a URL String.
For example:
If someone entered www.website.com.au/folder/category/item.php
I would like the .htaccess to retrieve the last two variables (being Category and Item) and parse them to my display-item.php page.
I have a rough idea of what I need to be doing (As per below) though with all the tutes I have been reading I am a little confused.
Any help would be greatly appreciated.
:) Paul
RewriteRule /folder/(.*)/(.*).php /folder/display-item.php?category=$1&item=$2 [L]

RewriteRule ^folder/(.*)/(.*).php /folder/display-item.php?category=$1&item=$2 [L]
Works a treat. Managed to get it working.

Related

How can I solve this .htaccess rewrite?

I need to make this simple rewrite, but I'm probably wrong because it doesn't work.
Original url format: http://www.mydomain.nop/folder/component/option,com_seminar/cid,134/task,3/
New url format: http://www.mydomain.nop/folder/component/eventbooking/seminar/134
The variables I need are these:
.../component/option,com_seminar/cid,num1/task,num2/
(the one after 'task,' is a variable number like the other but not necessary for the new url)
This is my code which however reports a 404 error
RewriteEngine On
...
RewriteRule ^/component/option,com_seminar/cid,([^/]*)/task,([^/]*)/$ /component/eventbooking/seminar/$1 [R=301,L]
Thanks in advance and apologize for my not perfect english
PS. I would like the code to work even without the last / of the original url

.htaccess help issues passing GET variables on mod_rewrite

Im a little puzzled here, i currently have the following rewrite rule to parse my pages...
RewriteRule ^([A-Za-z0-9_-]+)/?$ index.php?page=$1
My problem is that this works great for what i need however if i want to add GET variables for extra areas then this doesn't work so say i have http://domain.com/page will direct to the page but using http://domain.com/page?do=this returns the page but does not pass the get variables?
I have tried using & because it parsing index.php?page=$1 but this just returns url not found?
Any help, pointers or advice would be appreciated.
Thanks in advance.

.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]

.htaccess rewrite rules stops reading url after first part of string

Thank you for reading.
I am trying to rewrite all dynamic category links (/product_list.php?cat_id=xxx)
to more "friendly" text links. The problem I'm running into is with subcategories:
RewriteRule Complete-AC-Systems product_list.php?cat_id=2
works great, however when a sub category is present:
RewriteRule Complete-AC-Systems__Packaged-Systems product_list.php?cat_id=7
the browser stops reading after Complete-AC-Systems and re-directs to product_list.php?cat_id=2 not cat_id=7
Most of our categories are 3 and 4 levels in, so this is a pervasive issue.
Thanks for any help you can offer.
How about reversing the order of the rules? I.e., putting the longest matches first.

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]

Resources