Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
.ht access redirect with GET data
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- .ht access redirect with GET data
.ht access redirect with GET data
05-01-2008 9:55 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I wonder whether anybody here can help me out. I'm sure I'm being stupid, but I just can't figure this one out.
All I want to do is to redirect
I would have thought that something like these two lines would work:
The only way that I can find to do it is:
This passes the ?id data from link.php to linkredirect.php, and then use PHP's Header function to redirect to the page that I want.
Surely there must be an easier way than this. If anybody can help, I'd appreciate it.
PS: Is there another way to stop the forum code from automatically changing URLs into <a> tags, apart from using the CODE tag?
All I want to do is to redirect
www.mydomain.co.uk/link?id=nto
www.mydomain/link/n(where n is a number).
I would have thought that something like these two lines would work:
Redirect 301 /old_dir/link.php?id=([0-9]+)$ http://www.mydomain.co.uk/link/$1
RewriteRule ^old_dir/link.php?id=([0-9]+)$ http://www.mydomain.co.uk/link/$1
The only way that I can find to do it is:
Redirect 301 /old_dir/link.php http://www.mydomain.co.uk/linkredirect.php
This passes the ?id data from link.php to linkredirect.php, and then use PHP's Header function to redirect to the page that I want.
Surely there must be an easier way than this. If anybody can help, I'd appreciate it.
PS: Is there another way to stop the forum code from automatically changing URLs into <a> tags, apart from using the CODE tag?
Message 1 of 3
(2,310 Views)
2 REPLIES 2
Re: .ht access redirect with GET data
07-01-2008 9:31 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thank for your suggestion about bad bot lists.
Er, I'm still going up the learning curve, but a) I recall reading somewhere that redirect isn't the best way to do this (more appropriate for temporarily or permanently moving whole sites, where it has the advantage that search engines record the new addresses) and b) I also recall reading about the use of mod_rewrite to achieve this sort of thing. Amongst other possible options, a line 'Rewrite Engine On' is necessary directly above the RewriteRule(s), though this isn't always included in examples. (I read it as meaning something like, "rewrite on the following conditions:".
As you presumably don't have the string 'id=' in the domain portion of the address, it ought to be straightforward to write a rule that simply strips these 3 characters out before handing on the modifed address; with [NC] or whatever the option is to ignore case. Wikipedia has a list of useful sites at the end of the Rewrite Engine (aka Mod_Rewrite) page.
Of course we don't know for sure whether PN allows the use of mod_rewrite.
Er, I'm still going up the learning curve, but a) I recall reading somewhere that redirect isn't the best way to do this (more appropriate for temporarily or permanently moving whole sites, where it has the advantage that search engines record the new addresses) and b) I also recall reading about the use of mod_rewrite to achieve this sort of thing. Amongst other possible options, a line 'Rewrite Engine On' is necessary directly above the RewriteRule(s), though this isn't always included in examples. (I read it as meaning something like, "rewrite on the following conditions:".
As you presumably don't have the string 'id=' in the domain portion of the address, it ought to be straightforward to write a rule that simply strips these 3 characters out before handing on the modifed address; with [NC] or whatever the option is to ignore case. Wikipedia has a list of useful sites at the end of the Rewrite Engine (aka Mod_Rewrite) page.
Of course we don't know for sure whether PN allows the use of mod_rewrite.
Message 2 of 3
(353 Views)

Not applicable
Re: .ht access redirect with GET data
08-01-2008 11:28 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Pretty sure it is allowed - I'm sure I've used it in the past for a couple of bits and bobs.
Message 3 of 3
(353 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- .ht access redirect with GET data