Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #17423
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | pehache <pehache.7@gmail.com> |
| Newsgroups | comp.lang.php |
| Subject | Re: page redirecttion in PHP ? |
| Date | Sun, 7 May 2017 16:15:37 +0200 |
| Lines | 45 |
| Message-ID | <en8og9FdgglU2@mid.individual.net> (permalink) |
| References | <en83jtF9gfpU1@mid.individual.net> <590f2454$0$727$e4fe514c@news.xs4all.nl> <en8oa0FdgglU1@mid.individual.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | individual.net CUfu0uJYK3fcUm0Lq5tydQRlUnSbxJCwz4sQsVO9acsWhoHIP7 |
| Cancel-Lock | sha1:32r89xZA/i46rH6cfIvLVEjd4SU= |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
| In-Reply-To | <en8oa0FdgglU1@mid.individual.net> |
| Xref | csiph.com comp.lang.php:17423 |
Show key headers only | View raw
Le 07/05/2017 à 16:12, pehache a écrit :
> Le 07/05/2017 à 15:42, Luuk a écrit :
>> On 07-05-17 10:19, pehache wrote:
>>> Hi,
>>>
>>> I have converted an old SPIP site into a static version, using wget.
>>> It's OK, except that URLs of the type
>>>
>>> 1) http://xxx/article.php3?id_article=6296
>>>
>>> are now
>>>
>>> 2) http://xxx/article.php3?id_article=6296.html
>>>
>>> Not a big deal, Google re-index the site from the root URL http://xxx/
>>> which is still valid, but I wonder if there exist a simple mean to
>>> redirect the invalid URLs (1) to the valid ones (2) ?
>>>
>>> I guess that it could be done by creating an appropriate
>>> "article.php3" file, but I am a full newbie in php...
>>>
>>> Any help appreciated
>>>
>>>
>>
>>
>>
>> 1 <?php
>> 2 $id_article=$_GET["id_article"];
>> 3 if (substr($id_article,-4)!="html") {
>> 4 header('Location:
>> '.$_SERVER["SCRIPT_URI"]."?".$_SERVER["QUERY_STRING"].".html");
>> 5 exit(); }
>
> Great, this is exactly what I needed and it works just fine !
>
> Thanks !
>
Just had to replace the "?" by "%3F" in line 4, as the static URL in 2)
is rather
2) http://xxx/article.php3%3Fid_article=6296.html
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
page redirecttion in PHP ? pehache <pehache.7@gmail.com> - 2017-05-07 10:19 +0200
Re: page redirecttion in PHP ? Jerry Stuckle <jstucklex@attglobal.net> - 2017-05-07 07:43 -0400
Re: page redirecttion in PHP ? Luuk <luuk@invalid.lan> - 2017-05-07 15:42 +0200
Re: page redirecttion in PHP ? pehache <pehache.7@gmail.com> - 2017-05-07 16:12 +0200
Re: page redirecttion in PHP ? pehache <pehache.7@gmail.com> - 2017-05-07 16:15 +0200
Re: page redirecttion in PHP ? Jerry Stuckle <jstucklex@attglobal.net> - 2017-05-07 13:49 -0400
Re: page redirecttion in PHP ? pehache <pehache.7@gmail.com> - 2017-05-14 14:40 +0200
Re: page redirecttion in PHP ? "J.O. Aho" <user@example.net> - 2017-05-14 16:31 +0200
Re: page redirecttion in PHP ? pehache <pehache.7@gmail.com> - 2017-05-18 08:40 +0200
Re: page redirecttion in PHP ? Jerry Stuckle <jstucklex@attglobal.net> - 2017-05-18 08:14 -0400
csiph-web