Forums | Mahara Community

Support /
Clean URL


na li's profile picture
Posts: 61

09 November 2015, 21:05

Dear Mahara contributor,

I really appreciate your great contributions on Mahara. Our University is using Mahara and I'm following configuration of the clean URL according to mahara wiki.

I successfully configured the clean URL on our test server, it works well. But when I set the same settings on our production server, it doesn't work.

The version of apache on our test server is :Apache/2.4.6 (CentOS),CentOS Linux release 7.0.1406 (Core)

The version of apache on our production server is :Server version: Apache/2.2.15 (Unix), CentOS release 6.7 (Final)

The rewrite rule I've added to the httpd.conf file is as following, these rewrite rules do work on test server but not work on production server:

RewriteRule ^/user/([a-z0-9-]+)/?$ /user/view.php?profile=$1&%{QUERY_STRING} [NC]

RewriteRule ^/user/([a-z0-9-]+)/([a-z0-9-]+)/?$ /view/view.php?profile=$1&page=$2&%{QUERY_STRING} [NC]

RewriteRule ^/group/([a-z0-9-]+)/?$ /group/view.php?homepage=$1&%{QUERY_STRING} [NC]

RewriteRule ^/group/([a-z0-9-]+)/([a-z0-9-]+)/?$ /view/view.php?homepage=$1&page=$2&%{QUERY_STRING} [NC]

Could anyone help with this?

Thanks a lot.

Best wishes,

Lina

Aaron Wells's profile picture
Posts: 896

10 November 2015, 14:38

Hi Lina,

In general, you should always try to get your test environment to be identical to your production environment. Same operating system, same web browser, same versions, etc. There are quite a few differences between Apache 2.2 and Apache 2.4. :)

I don't see anything obviously incorrect here. Although, the "[NC]" flags should not be necessary and may be causing problems.

Can you be more specific about what's going wrong? Are there error messages when you try to start Apache, or is it sending you to the wrong page when you try to access a user's pages?

Cheers,

Aaron

na li's profile picture
Posts: 61

10 November 2015, 21:20

Dear Aaron,

Thanks for your reply.

I tried to explain more details but I do not have permission to post links. Even the screenshots with links are not allowed to post. It's a little hard for me to explain the situation. I have an error message for both the test server and production server:

Starting httpd: httpd: apr_sockaddr_info_get() failed for lnx-mahara.xjtlu.edu.cn
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

Following is the error message I've got when I try to go to user's profile page with the clean url:

Not Found

The requested URL /user/na-li was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


Apache/2.2.15 (CentOS) Server at mahara.xjtlu.edu.cn Port 443

 

Thanks a lot.

Best wishes,

Lina

Kristina Hoeppner's profile picture
Posts: 4717

13 November 2015, 3:17

Hello Lina,

You can now post links. Your account was on probation, but since you've had some interaction with an existing member of the community, the probation has been lifted.

Great to read that your instance works now.

Cheers

Kristina

 

na li's profile picture
Posts: 61

13 November 2015, 19:29

Dear Kristina,

Thanks a lot for your support. I really think Mahara is a powerful platform and this forum is great. I've got very friendly and efficient help.

Best wishes,

Lina

Kristina Hoeppner's profile picture
Posts: 4717

02 December 2015, 8:27

Hello Lina,

Thank you for your feedback. It's good to hear that the help provided is useful to you.

Cheers

Kristina

 

na li's profile picture
Posts: 61

11 November 2015, 20:08

Dear Aaron,

I think I found the reason but still cannot fix.

Our production server is using https, but test server is not. If I manually remove 's' from https, the rewrite rule can work. But considering the information security, we have to use https. How can I use https and make the clean URL available at the same time?

Could you please help?

Thanks a lot.

Best wishes,

Lina

Kevin Rickis's profile picture
Posts: 67

12 November 2015, 0:32

Hi Lina.

I have my rewrite rules in .htaccess rather than in httpd.conf this is what works for me with https.

 <IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://yoursite.com/$1 [R=301,L]
RewriteRule ^user/([a-z0-9-]+)/?$ /user/view.php?profile=$1&%{QUERY_STRING}
RewriteRule ^user/([a-z0-9-]+)/([a-z0-9-]+)/?$ /view/view.php?profile=$1&page=$2&%{QUERY_STRING}
RewriteRule ^group/([a-z0-9-]+)/?$ /group/view.php?homepage=$1&%{QUERY_STRING}
RewriteRule ^group/([a-z0-9-]+)/([a-z0-9-]+)/?$ /view/view.php?homepage=$1&page=$2&%{QUERY_STRING}
</IfModule>


Hope this helps.

Kevin
na li's profile picture
Posts: 61

12 November 2015, 1:18

Dear Kevin,

Thanks a lot for your help.

Since I'm not using a virtual host, so I think I can only add the rewrite rules to httpd.conf file. I've added the RewriteRule that you shared with me. But when I try to rewrite to /user/name, it still showed the 404 not found message. When I removed the 's' manually from 'https', the rewrite can work then.

There's a setting on mahara's administration page, I've selected use https. Did you do the same when you installed https for your mahara server?

Thanks.

Best wishes,

Lina

Kevin Rickis's profile picture
Posts: 67

12 November 2015, 2:10

Hi Lina,

as it's not working anyway you could try the .htaccess, just delete the file if it makes no difference or breaks stuff. 

I assume you have  $cfg->wwwroot in config.php set to https://yoursitename.dot

Good luck,

Kevin

12 results