Welcome to WebmasterWorld Guest from 54.162.164.247

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Complex apache redirect

     
11:28 am on Jun 10, 2003 (gmt 0)

New User

10+ Year Member

joined:June 10, 2003
posts:3
votes: 0


/article_info.php/name/something-something-something/cArticlePath/1/articles_id/9

should be redirected to:

/newsdesk_info.php/name/something-something-something/newsPath/1/newsdesk_id/9

in other words in url:

article_info.php >> newsdesk_info.php
cArticlePath >> newsPath
articles_id >> newsdesk_id

Anyone?

5:12 pm on June 10, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Mazza,

Welcome to WebmasterWorld [webmasterworld.com]!

/article_info.php/name/something-something-something/cArticlePath/1/articles_id/9

should be redirected to:

/newsdesk_info.php/name/something-something-something/newsPath/1/newsdesk_id/9

in other words in url:

article_info.php >> newsdesk_info.php
cArticlePath >> newsPath
articles_id >> newsdesk_id


Something like this should work in .htaccess. If you are adding this to httpd.conf, start the pattern with "^/article" - i.e., add a preceding slash.

RewriteRule ^article\_info\.php/name/(.+)/cArticlePath/(.+)/articles\_id/(.+)$ /newsdesk_info.php/name/$1/newsPath/$2/newsdesk_id/$3 [L]

Ref: Introduction to mod_rewrite [webmasterworld.com]

HTH,
Jim

9:04 am on June 11, 2003 (gmt 0)

New User

10+ Year Member

joined:June 10, 2003
posts:3
votes: 0


Thank you Jim for trying to help. The code however does not seem to have any effect. I would gues the problem is with me not knowing how to use it. Heres a sample of the subdomain rigth above the section where I inserted the code:

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
# Alidomain
RewriteCond %{HTTP_HOST} testing.mydomain.net$
RewriteCond %{REQUEST_URI}!shop/
RewriteRule ^(.*)$ shop/$1

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteRule ^article\_info\.php/name/(.+)/cArticlePath/(.+)/articles\_id/(.+)$ /newsdesk_info.php/name/$1/newsPath/$2/newsdesk_id/$3 [R=301,L]

It is in an htaccess file on a shared server. But it should work since the subdomains are working , rigth?

Also none of the files are in the root but have sub domains on them like:

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
# Alidomain
RewriteCond %{HTTP_HOST} www.mysite.net$
RewriteCond %{REQUEST_URI}!catalog2/
RewriteRule ^(.*)$ catalog2/$1

5:02 pm on June 11, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Mazza,

Apologies for the delay - I suspect we're on opposite sides of the world...

I'll have to get back to you on this, but I do see something that may need to be fixed: You have multiple occurrences of Options, RewriteEngine, and RewriteBase directives in your file, and they are in the wrong order.

Place this sequence before any RewriteCond or RewriteRule directives, and include it in each .htaccess file only once:


Options +FollowSymLinks
RewriteEngine on
RewriteBase /

In addition, none of your existing rules have an [L] flag on them, which means the RewriteEngine will continue to process all rewrite rules for all requests, even after applying a rewrite. In most cases, this won't cause problems other than slowing down your server slightly, but realize that if the output URL from one rewriterule matches the pattern of a following rule, then the URL will be rewritten again.

The pattern on the left side of the rule I sent you will match only if your .htaccess file is in a directory that has a subdirectory named "/article". If this is not true, then the code will do nothing.

I'll look at your post again when I get back and see if I can spot anything else wrong. In the meantime, perhaps one of the points above may help, and you might wish to spend some time studying the post I cited above, and the information linked from that post.

HTH,
Jim

7:15 pm on June 12, 2003 (gmt 0)

New User

10+ Year Member

joined:June 10, 2003
posts:3
votes: 0


No problem, Jim. I am not on a deadline. Would just like to drop the old article management system from my site. And now thanks to you, we can.

Moving the rewrite to a new htaccess file and moving it to the same folder as the files did the trick. And by modifying it I found a way to do three more similar redirects. Thank you for your help. I really appreciate it.

9:54 pm on June 12, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Mazza,

Glad that worked out! I had to take a break from WebmasterWorld and actually do some work over the past couple of days! :)

Jim

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members