HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Can I a use the redirect feature for this?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#73033 (In Topic #15303)
Avatar

Community saint

Can I use the redirect feature to force xxxxxx.com: The Leading XXX Site on the Net to go to xxxxxxx.com: The Leading XXX Site on the Net I tried setting this up but it did not work when clicking "News/Blog categories" breadcrumb link. I don't want members to see the "News/Blogs categories", only the "Blogs".

Thanks for any help.

Bob
Back to the top
 
Posted
Rating:
#73049
Avatar

No you'll need to use a non-ocPortal .htaccess redirect.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#73067
Avatar

Community saint

Thanks Chris.
Back to the top
 
Posted
Rating:
#73074
Avatar

Community saint

Okay, it seems a simple redirect does not do the job. Can anyone provide a clue as to how to write the 301 redirect with mod_rewrite enabled to go from

Code

http://xxxxxx.com/news/select.htm

to

Code

http://xxxxxx.com/news/blog_select.htm

Thanks for any help. Hopefully, this will be a good primer for me to understanding how to write these redirects with rewritten URLs.

Bob
Back to the top
 
Posted
Rating:
#73242
Avatar

Community saint

I am still struggling with this issue.

If I use a simple 301 redirect to the new page I get an error 500 "Internal server error".

Since I am using URL monikers and Short URLs, I am guessing that I need to use a Rewrite Rule instead of the redirect. Am i even close with this?

Is there a bunch of regex foo that needs doing to write this simple redirect?

Thanks for any help.

Bob
Back to the top
 
Posted
Rating:
#73301
Avatar

Community saint

Since I am putting the Facebook add-on on hold until it is more reliable, this is my last technical issue before opening the site (I still have theming do do but I will be able to let some special members sign up and start making contribution).

Can anyone please steer me in the right direction so that:

Code

http://xxxxxx.com/news/select.htm

is redirected to:

Code

http://xxxxxx.com/news/blog_select.htm

I've tried simple 301 redirects and tried emulating the rewrite code that is used in .htaccess but I am not having any luck.

Is there any kind soul who is a master of regex and rewriting URLs who can point me in the right direction.

Thanks for any help.

Bob
Back to the top
 
Posted
Rating:
#73302
Avatar

I'd just Google it myself.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#73303
Avatar

Community saint

Oh, I've tried that. I've read a few tutorials front-to-back but I am obviously missing something which is making me feel quite dense.

I'll keep plugging away at it.

Bob

Back to the top
 
Posted
Rating:
#73304
Avatar

I wonder if your web host don't have mod_redirect and/or mod_rewrite turned on. Maybe ask them, or look if they have any tutorials.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#73306
Avatar

Community saint

mod_rewrite is on as I am using rewritten short URLs. I'm just having a bit of a problem figuring out the long URL which is what appears to be needed for the rewrite rule.

I just realized that I can turn off the rewritten URLs feature which will allow me to see the full URL.

I'm going to give this a try.

Thanks for your help.

Bob
Back to the top
 
Posted
Rating:
#73311
Avatar

Community saint

This is the Rewrite rule I currently have in the rewrite portion of .htaccess which does not work:

Code

RewriteRule ^([^/\&\?]+)/index.php?page=news&type=select$ $1/news/blog_select.htm [L,QSA]

I have also tried using a redirect with a hard-coded FQDN which also did not work.

Can anyone point me in the right direction? I have a hunch that it is in the old URL which is not right but it seems to me that it should be.

Thanks to anyone who can point me in the right direction.

Bob
Back to the top
 
Posted
Rating:
#75549
Avatar

Community saint

I tried building on the success I had with temp1024's explanation and handy-dandy rewrite tester but I am coming up empty. I want the link:

Code

http://www.julianrittercentral.com/news.htm

to go to

Code

http://www.julianrittercentral.com/news/blog_select.htm

So, I have crafted the following rewrite rule which I placed right under my other successful rewrite:

Code

RewriteRule ^(.*)/news.htm $1/news/blog_select.htm  [NC,L,R=301]

The strange thing is that is passes muster in the rewrite tester but it has no effect on my site (after clearing template and browser cache):


What obvious thing have I missed?

Geez, I really thought I was starting to grasp this.

Thanks for any help.

Bob
Back to the top
 
Posted
Rating:
#75550
Avatar

Put it above ocPortal's rewrite rules.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#75551
Avatar

Community saint

Chris-

I did:
RewriteEngine on

#Redirect to www
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.julianrittercentral\.com [NC]
RewriteRule ^(.*)$ 404 Not Found - JulianRitterCentral [L,R=301]

RewriteRule ^(.*)/stories-about-julian-/ $1/stories-about-julian-.htm  [NC,L,R=301]    #Rewrite old URLs to parent directory
RewriteRule ^(.*)/news.htm $1/news/blog_select.htm  [NC,L,R=301]    #Restrict access to news, redirect to blogs

# Redirect away from modules called directly by URL. Helpful as it allows you to "run" a module file in a debugger and still see it running.
RewriteRule ^([^=]*)webdav.php/([^=]*)pages/(modules|modules\_custom)/([
^/]*)\.php$ - [L]
RewriteRule ^([^=]*)pages/(modules|modules\_custom)/([^/]*)\.php$ $1index.php\?page=$3 [L,QSA,R]

I put it just beneath another rule that works which is why I am so confused - the other rule works and the rewrite tester says this should work.

Thanks for your help.

Bob
Back to the top
 
Posted
Rating:
#75552
Avatar

Try killing the slash and simplifying…

RewriteRule ^news.htm news/blog_select.htm  [NC,L,R=301]

I don't think rewrite rules get a leading slash on there, so if it's in the root it would not match.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#75553
Avatar

Community saint

That did the trick.

I've added this new tidbit to my growing collection of dos and donts for regex and rewrite which seems to me something approaching the black arts.

Thanks for your help, Chris.

Bob


Back to the top
 
Posted
Rating:
#75554
Avatar

Community saint

Bob, when using the tester drop the http ://www.julianrittercentral.com/ from the tester, as the tester already applies a generic host, namely http ://hostname/ . Otherwise what you will be testing is
http ://hostname/http ://www.julianrittercentral.com/

This also matches up with Chris' comment to remove the slash from the rule as it is already included in http ://hostname/ .

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Item has a rating of 5 (Liked by Guest)  
Rating:
#75556
Avatar

Community saint

temp-

Now it all makes sense. When I tested with the slash and no domain, it failed to change the URL. So then I added the domain even though I knew from the looks of it that I shouldn't - but it worked. Now I understand why it failed the first time.

Thanks to both you and Chris for helping me to (very) slowly wrap my head around this stuff.

Bob
Back to the top
 
Posted
Rating:
#75575
Avatar

Community saint

Well, the above works a little too well. It also redirects

Code

/forum/forumview/misc/news.htm

So I need a way to say only /news.htm is rewritten. I suspect that this starts getting complicated as in I haven't a clue where to start looking. Not to mention the link to the article "URL rewriting for beginners" is not working.

Any clues?

Thanks for any help.

Bob
Back to the top
 
Posted
Rating:
#75577
Avatar

Community saint

I got this one sorted with a simple redirect:

Code

redirect 301 /news.htm http://www.domain.com/news/blog_select.htm

I thought I tried that before and got an error 500. Must have just put it in the wrong place or otherwise I may actually be learning a bit.

Bob
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Expand