Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I make redirection ?
#1
Hello,

I want to change url of some pages. How can I make redirection in GS ?

Thanks.
Reply
#2
Edit .htaccess file, and try to add at the end below rule:
Code:
RedirectMatch 301 ^/page_slug$ http://www.yourwebsite.com/page_slug

if the page had a parent, you might have to add the parent's slug in .com/parent_slug/page_slug
It would be better if you have provided example links on your page, as some of us use own link structure and rewrite rules Wink

ps. page_slug is the physical file name/URL of the page,
Addons: blue business theme, Online Visitors, Notepad
Reply
#3
Hello,

I don't understand this rule... Why you put [ url ] ?
Reply
#4
I've just noticed that forum script added a bbcode url inside code tag after I did a small edit in my earlier post.
Addons: blue business theme, Online Visitors, Notepad
Reply
#5
Ok Smile

Redirect (match or permanent) don't work. For example, if you put your redirect rule, the result :

http://www.domain.tld/old-slug become http://www.domain.tld/new-slug?id=old-slug
Reply
#6
I had the same problem when I made some redirects on get-simple.info pointing the old docs to the new wiki. Here is what my .htaccess file looks like. Pay attention to the placement of things here:
Code:
RewriteBase /

# redirects from old docs to new wiki links
RewriteRule ^download/requirements/?$ http://get-simple.info/wiki/installation:requirements [R=301,L]
RewriteRule ^docs/theme-codex/?$ http://get-simple.info/wiki/themes:creation [R=301,L]
RewriteRule ^docs/theme-creation/?$ http://get-simple.info/wiki/themes:creation [R=301,L]
RewriteRule ^docs/plugin-creation/?$ http://get-simple.info/wiki/plugins:creation [R=301,L]
RewriteRule ^download/languages/?$ http://get-simple.info/wiki/languages [R=301,L]
RewriteRule ^docs/permalinks/?$ http://get-simple.info/wiki/pretty_urls [R=301,L]
RewriteRule ^docs/installation/?$ http://get-simple.info/wiki/installation [R=301,L]
RewriteRule ^docs/?$ http://get-simple.info/wiki/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
rewriteCond %{REQUEST_FILENAME} !-d

RewriteRule /?([^/][A-Za-z0-9-]+)/?$ index.php?id=$1 [QSA,L]
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#7
Nice Cagle ! That work ! Thanks Smile
Reply
#8
Thanks! That helped me as well. After installing GS on a site which had urls with an ".html" ending, I needed redirecting them to the new fancy urls without the .html - e.g. "site.com/page.html --> site.com/page/"

Code:
RewriteRule ^page.html http://site.com/page [R=301,L]

works perfect now!
Reply
#9
Hi there,

I just finished a project where we convinced the client to make the switch from the dark side (read: Joomla) to Get Simple. And they absolutely love it!

Only thing left is some 301 redirects from the old Joomla pages to their new GS counterparts, although I am having some difficulties there as a result of the url structure of their previous Joomla site.

They didn't use fancy urls there, so the urls contains things like: ?option=com_content&task=view&id=16&Itemid=32

Having searched through the forum I found the pointers above, which seemed to work for the persons trying them.

However, when I try something along the lines of:

Code:
RewriteRule ^index.php?option=com_content&task=view&id=19&Itemid=35$ http://www.liftus.nl/service-onderhoud/ [R=301,L]

it will yield a 'page not found'.

I also tried combinations with the site url in there, without index.php, etc. Nothing seems to work so far...

I have included the redirect code in the exact same position as Chris' example above.

Somebody have any idea how to redirect a Joomla-esque url like above correctly?
Reply
#10
Draxeiro Wrote:...
However, when I try something along the lines of:

Code:
RewriteRule ^index.php?option=com_content&task=view&id=19&Itemid=35$ http://www.liftus.nl/service-onderhoud/ [R=301,L]

it will yield a 'page not found'.

Two problems:
  • RewriteRules only work on the part before the query string
  • Even if they worked with the query string, ? is a special character in a regular expression and must be escaped

You should try something like
Code:
RewriteCond %{QUERY_STRING} Itemid=35$
RewriteRule ^index.php$ http://www.liftus.nl/service-onderhoud/ [R=301,L]
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#11
Most htaccess rules are like swahili for me and I am always very much impressed when people actually understand those incredibly cryptic (at least in my eyes) settings.

Played around with your suggestion but it gets stuck in a redirect loop.

Looking at that joomla url it seems there are so many variables. I tried including them all, same result or should they have been included in separate query strings?

Also tried the old fashioned Redirect 301. Doesn't seem to work either.

Wouldn't surprise if this will not end up working in the end. Oh well, at least they do end up on the site (albeit the 'page not found' notice as things are now).
Reply
#12
Draxeiro Wrote:Played around with your suggestion but it gets stuck in a redirect loop.

Try (note the ?):
RewriteCond %{QUERY_STRING} Itemid=35$
RewriteRule ^index.php$ http://www.liftus.nl/service-onderhoud/? [R=301,L]
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#13
I could kiss you! (but don't worry, I won't hahaha).

Works perfectly!!!

I honestly would never have figured this out, thank you very very much.
Reply
#14
Hi there,
I tried the above suggested solution

RewriteRule ^old.html?$ http://www.my-domain.de/new [R=301,L]

But the result is an error page with the URL

http://www.my-domain.de/new/?id=html

How can I get rid of this "?id=html"?

Thank you for your help
SoHo
Reply
#15
In this case the "?$" was wrong. I deleted it and everything works. Very simple - when you got the solution ;-)

PROBLEM SOLVED
Reply
#16
That works well for redirects, however, now the page doesn't load if there's no "slash" at the end.

My redirect text is now:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/$ index.php?id=$1 [QSA,L]

Now, "http://www.irisemedia.com/internet-marketing-solutions/" is very different from "http://www.irisemedia.com/internet-marketing-solutions" (no slash). How do I fix this so that the page shows with/without the slash and still be able to redirect URLs?

(2013-06-24, 03:09:20)SoHo22 Wrote: In this case the "?$" was wrong. I deleted it and everything works. Very simple - when you got the solution ;-)

PROBLEM SOLVED
Reply
#17
What I personally found works MUCH better is to place the redirect text RIGHT BEFORE the rewrite text and rewrite base. Now it works beautifully.

(2013-08-29, 02:17:39)rhecht Wrote: That works well for redirects, however, now the page doesn't load if there's no "slash" at the end.

My redirect text is now:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/$ index.php?id=$1 [QSA,L]

Now, "http://www.irisemedia.com/internet-marketing-solutions/" is very different from "http://www.irisemedia.com/internet-marketing-solutions" (no slash). How do I fix this so that the page shows with/without the slash and still be able to redirect URLs?

(2013-06-24, 03:09:20)SoHo22 Wrote: In this case the "?$" was wrong. I deleted it and everything works. Very simple - when you got the solution ;-)

PROBLEM SOLVED
Reply
#18
Thanx for this thread!
Reply
#19
Hi to all,

I have a similar problem but not the brain to adopt your solution.
I use fancy urls with these rules in .htaccess:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+).html$ index.php?id=$1 [QSA,L]

This results in pages like www.tld.com/site.html

Now I want 301 redirections from old urls like www.tld.com/oldsite.html to the new site.html.

And I always get a redirection to www.tld.com/site.html?id=site

How can I formulare the rewrite rule for workung redirections?
Reply
#20
Try
RewriteRule ^oldsite.html site.html [R=301,L]
Reply




Users browsing this thread: 1 Guest(s)