Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

There are two predefined URLs which I want to redirect to default controller's method and return default responses. URLs are:

URL 1: http://EnrollmentService.mydomain.com/EnrollmentServer/Discover.svc (GET request)

URL 2: https://EnrollmentService.mydomain.com/EnrollmentServer/Discover.svc (POST request)

I tried adding following to .htaccess file but no luck.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /testsaav/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    Redirect /enrollmentserver/Discover.svc http://localhost/projectname/
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

Right now I am trying to redirect http://localhost/projectname/EnrollmentServer/Discover.svc to default controller's index method.
I have created a project with default controller name enrollmentserver.php but when I tried to access http://localhost/projectname/enrollmentserver, I got Object not found error

How would redirect both the urls to default controller's any method?

share|improve this question

1 Answer

You should use the default CI routes system. In your application/config/routes file:

$route['EnrollmentServer/Discover.svc'] = "projectname";

Or generically:

$route['EnrollmentServer/:any'] = "projectname";

Assuming "projectname" is the controller you want to route to

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.