I need help to redirect old URL to new URL by using .htaccess.
I code my website by using CakePHP. Initially, I didn't change pagination URL structure. So my URL looking like this. This is just an example, actually it contain a lot more sub-directory & pages.
http://www.web.com/abc/
http://www.web.com/abc/page/page:2/
http://www.web.com/abc/page/page:3/
...
...
http://www.web.com/def/
http://www.web.com/def/page/page:2/
http://www.web.com/def/page/page:3/
...
...
http://www.web.com/ghi/
http://www.web.com/ghi/page/page:2/
http://www.web.com/ghi/page/page:3/
...
...
Many people say this is not good for SEO, so I change my URL structure to be like this. The coding is CakePHP is all done.
http://www.web.com/abc/
http://www.web.com/abc/page/2/
http://www.web.com/abc/page/3/
...
...
http://www.web.com/def/
http://www.web.com/def/page/2/
http://www.web.com/def/page/3/
...
...
http://www.web.com/ghi/
http://www.web.com/ghi/page/2/
http://www.web.com/ghi/page/3/
...
...
What I need to do next is to redirect my old URL to the new URL. I need help on the proper code which can redirect all my URL without doing it one by one.
Really appreciate any help on this. TQ
Well something like this should work
RewriteRule ^(.+)/page:([0-9]+)/$ /$1/$2/ [R=301,L]
RewriteEngine On
RewriteRule ^(.*)/page:([0-9]*)(.*)$ /$1/page/$2$3 [R=301,L]
Related
I need help from experts to solve my problem. I'm just starting to learn rewriterule, rbase, and rcond. I want to rewrite my site link like codeigniter MVC. For example:
http://localhost/app/index.php?page=profile&user=john -> http://localhost/app/index/page/profile/user/john
How to do that? I tried to change for many times, but i don't get url like that but error occured.
RewriteRule ^index/page/(.*)/user/(.*)$ /index.php?page=$1&user=$2 [L]
I need to rewrite a url for specific component in joomla so that actual component name is not visible in url .
E.g index.php?option=com_mycomponent
I need to replace com_mycomponent to xyz
Also I installed joomsef extension but it does not work fine with language filter plugin in joomla.
So I need to rewrite a url for specific component using htaccess
So please suggest me appropriate solution asap
The "Simple Custom Router" extension may be able to help you:
http://extensions.joomla.org/extensions/site-management/sef/21251
Hopefully this is ASAP enough for you. :)
Have you tried a basic .htaccess rewrite? Shouldn't be too tough with basic rewrite engine:
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^my_component_pretty_url$ ?option=com_mycomponent [NC,L]
If anyone has better rewrite rules, please add...mine are super basic.
Try this,
RewriteEngine On
RewriteRule ^chaletreservation$ index.php?option=com_jrestaurantreservation [QSA,L]
RewriteRule ^chaletreservation(.+)$ index.php?option=com_jrestaurantreservation&$1 [QSA,L]
Then simply use where ever you need this component urls index.php?option=com_jrestaurantreservation like below,
www.yourdomain.com/chaletreservation
Hope its works..
I change my URL name using mod write. But my URL doesn't show the changes on browser.
This is how it looks from before and after
www.mydomain.com/toy/image.php
to this
www.mydomain.com/toy/xbox
How can I make this: www.mydomain.com/toy/xbox appear on the browser
Another words on my website it should appear www.mydomain.com/toy/xbox instead of this
www.mydomain.com/toy/image.php
This is my code:
RewriteEngine On
RewriteRule ^toy/xbox$ /toy/image.php* [L,R]
Can someone to explain to me how it works. Did I missed a step? Do I need to used PHP?
If I did make a mistake, correct me so I can learn from my mistakes. I try to google this but I couldn't find what I need to do
Any links or explanations would be appreciated. Thanks.
For it to "show the URL," you need it to do a 301/302 redirect, with a location header. All you have to do is end your RewriteRule line with [L,R=301]
You must perform a redirect using the R flag instead of just a rewrite.
RewriteRule ... ... [R]
I have a link like www.example.com/hello-1/hey-2, now what I want to do is that I want to redirect to this link from www.example.com/hello-1/hey. How to write a htaccess rule for this. I have tried searching on it, tried the same way to reduce index.php but that didn't work.Thank you.
See, basically I want people to be redirected when the type www.example.com/hello-1/hey this was my old link. I want them to be redirected to www.example.com/hello-1/hey-2, where this 2 is important as it's passing a parameter for me.
Basically, it's possible to do so;
RewriteEngine On
RewriteRule ^hello-1/hey$ hello-1/hey-2 [R=301,L]
I am runing a site wishberry.in on cakephp framework. I had some dirty URLs previously and now i want them to cleanup through .htaccess
I original url was wishberry.in/createwishlist3 and i want to change that to wishberry.in/brands with a 301 redirect.
The reason for using 301 is, if someone type wishberry.in/createwishlist3, the page will take them to /brands automatically.
Can anyone help me out what to write in my .htaccess file.
I would recommend doing this with routes in CakePHP rather than the .htaccess file. See http://bakery.cakephp.org/articles/Frank/2009/11/02/cakephp-s-routing-explained for more details.
The following should do the trick:
RewriteEngine On
RewriteRule ^createwishlist3$ /brands [R=301,L,NC]
Hope this helps.