Problem with redirect pages containing index.php?

Permalink
Hi Guys,

I tried to redirect pages from the old installation of a website
like:
"mywebsite.com/index.php?page=contact"

to the page:
"mywebsite.com/en/contact"

inside the "Location" panel of a page.
That don't works - it always redirects to the front page:
"mywebsite.com/en"

I think all pages with an /index.php? will be redirected to the start page. I tried without internationalization and with 5.7.5RC1

Any Idea how to solve this - is it a bug (using 5.7.4.2)?

Best,
Torsten

1 Attachment

tsilbermann
 
Remo replied on at Permalink Reply
Remo
did you try that with .htaccess? Can you post your htaccess file?
I'd assume -f causes the problem because index.php is an actual file that exists on your new site..
tsilbermann replied on at Permalink Reply
tsilbermann
I tried with and without pretty URLs enabled.
I didn't changed things in .htaccess file:

# -- concrete5 urls start --
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
        # -- concrete5 urls end --


I tried it with pretty URLs turned off and removed the .htaccess file - same result: redirects to start page.
Remo replied on at Permalink Reply
Remo
and where are the redirect rules? I can't see how you're redirecting the old to the new pages..
tsilbermann replied on at Permalink Reply 1 Attachment
tsilbermann
I tried it from "Location" panel of a page. See attached image above.
The URL redirects (301) - but not to this page (in this case "contact") - it redirects to the start page.

Lets say the old installation had a page with the URL:
"mypage.com/contactpage"

I can redirect it to the new page called:
"mypage.com/contact"

within the page "Location" panel adding a URL called:
"/contactpage"

this redirects to my new page called "contact".

But not if "index.php?" is inside the old url
Remo replied on at Permalink Reply
Remo
sorry, missed that attachment!

That approach won't work, index.php is a page and ?page=contact is nothing but a parameter to a page and won't be considered as an URI.

You'll either have to use an add-on like URL director which doesn't exist for 5.7 or create a custom .htaccess file to redirect those addresses..
tsilbermann replied on at Permalink Reply
tsilbermann
That means this page redirect function in concrete5 is not made for such redirects?
Even if ?page=contact is just an parameter - its an URL that will be redirected by the concrete5 redirection function - but wrong.

I think this often happens when relaunching a website (old site: index.php?=contact - new site: pretty URLs) and I thought this function is for such kind of redirects. I don't think this is a very special case.

Shouldn't it be part of this function?
Remo replied on at Permalink Reply
Remo
No, that will never work for parameters, that would cause a ton of other problems. You can redirect the path, but not the full URI.

We only ever use this function when we move pages in concrete5 around, never to handle redirects, that's not the intent of this function.
tsilbermann replied on at Permalink Reply
tsilbermann
Ok - its just for using inside the concrete5 installation. It's too bad - would be a nice feature...
I need to find another solution.

Thanks a lot Remo :-)