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.
Related
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
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]
I used to have a WP site that I converted to a standard html site. Problem is I found doing a google search that instead of http://www.genealogyinc.com it was returning http://www.genealogyinc.com/?page_id=21, I dont know how many pages are like this but am trying to find a htaccess workaround, all the ones I found online give me 500 server errors.
Need a rewrite for any ?page_id= cause I dont know how many other numbers are out there.
Thanks
Off the top of my head, without testing, it would be something like this.
The first line looks for the page_id querystring parameter, and if it meets it, it should pass on to the second line. The rewrite rule I have below may need some tweaking, but I hope this helps you.
RewriteCond %{QUERY_STRING} page_id=(.*)$
RewriteRule $ /? [R=301,L]
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.
I am writing htacess redirect rule but it is not working properly I have tried many solutions but simply it is not working.
What I want to do is to
I have url http://example.com/cms/index.php?page=filename I want this url to be executed and show appropriate page but in browser it should show example.com/cms. And what is important is I only want to right this rule for this page only and it should not effect to other pages.
Thank you.
RewriteRule ^([^/]+)/$ /cms/index.php?filename=$1 [L,QSA]
The L at the end says it is the last rule (stop processing) and QSA means 'Query String Append', so if someone puts other parameters after it, such as:
http://example.com/cms.htm?order=desc
The GET value for order will be passed also - without it it'll just quietly drop it.
Something like this ought to work:
RewriteEngine on
RewriteRule ^http://example.com/cms$ http://example.com/cms/index.php?page=filename
...should work.
Have a look at a tutorial with some examples if you're interested in seeing what else you can do.