logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: rewrite and redirect not working in v2.4.29 after upgrade
Author
robnye



Joined: 23 Mar 2018
Posts: 2
Location: UK

PostPosted: Mon 09 Apr '18 23:52    Post subject: rewrite and redirect not working in v2.4.29 after upgrade Reply with quote

Hello,

I am a newbie to Apache configuration and was tasked with upgrading Apache from v2.2 to v2.4 on a windows 2012 R2 server, all seemed to go well, until I had problems in v2.4 with the rewrite rule
so I attempted to change it to use a redirect rule.

In v2.2 it was setup to use rewrite commands, these didnt seem to work when applied to the v2.4 config, so I changed it to use redirect command.

I have checked that I'm loading the mod_rewrite module

now I am confused as some urls work and some dont when using v2.4. Yet if I revert back to v2.2 everything is fine.

We have internal and external users all coming in via the same Apache webserver,
I need to force all urls to convert to the https://robs.test.co.uk/test_ext, so the users can use SSL.

following are results using rewrite rule (as set in the v2.2 Apache httpd-vhosts.conf file)

RewriteRule ^/(.*)$ https://robs.test.co.uk/$1 [R]

http://robs.test.co.uk - converts to https://robs.test.co.uk/test_ext/ - successful ext user login
http://robs.test.co.uk/ - converts to https://robs.test.co.uk/test_ext/ - successful ext user login
http://robs.test.co.uk/test_int - converts to https://robs.test.co.uk/test_int - successful login
https://robs.test.co.uk/test_int - no conversion - successful login
https://robs.test.co.uk - converts to https://robs.test.co.uk/test_ext/ - fails with 403 Access Denied error
https://robs.test.co.uk/ - converts to https://robs.test.co.uk/test_ext - fails with 403 Access Denied error
https://robs.test.co.uk/test_ext - no conversion - fails with 403 Access Denied error

and using redirect rule (as set in the v2.4 Apache httpd-vhosts.conf file)

Redirect "/" "https://robs.test.co.uk/"

http://robs.test.co.uk - converts to https://robs.test.co.uk/test_ext/ - successful ext user login
http://robs.test.co.uk/ - converts to https://robs.test.co.uk/test_ext/ - fails with 403 Access Denied error
http://robs.test.co.uk/test_int - converts to https://robs.test.co.uk/test_int - successful login
https://robs.test.co.uk/test_int - no conversion - successful login
https://robs.test.co.uk - converts to https://robs.test.co.uk/test_ext/ - fails with 403 Access Denied error
https://robs.test.co.uk/ - converts to https://robs.test.co.uk/test_ext - fails with 403 Access Denied error
https://robs.test.co.uk/test_ext - no conversion - fails with 403 Access Denied error

to add to the confusion there is some addtional config for rewrites in the httpd-ssl.conf which maybe whats confusing the switch from http to https

# setup default environment
RewriteRule ^/$ /test_ext/ [R,L]
#
# fix the Home link on app menu - has no closing /
RewriteRule ^/(.*)_ext$ /$1_ext/ [R,L]
RewriteRule ^/(.*)_int$ /$1_int/ [R,L]

any pointers greatly received Smile
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Wed 25 Apr '18 16:17    Post subject: Reply with quote

Use a rewrite log file and might bring some light into it. Also You may check the access and error log.
Back to top
robnye



Joined: 23 Mar 2018
Posts: 2
Location: UK

PostPosted: Tue 08 May '18 16:24    Post subject: solved....... Reply with quote

it turns out that the userid I was given to test with wont work with the default url test_Ext hence why I couldnt validate the redirect.

Since then I have been given another test userid that does work on the default url

the 'redirect' rule wasnt required as teh old 'rewrite' rule did actually work Smile

I dont feel daft at all Rolling Eyes
Back to top


Reply to topic   Topic: rewrite and redirect not working in v2.4.29 after upgrade View previous topic :: View next topic
Post new topic   Forum Index -> Apache