Welcome Guest, Not a member yet? Register   Sign In
Specific rewrite rule
#1

[eluser]Unknown[/eluser]
Hi every one,

I created in a same controller 4 pages which contain a form.

I named my controller “my_controller”
The 4 pages are in methods and I have 4 pages with this structure :

- http://mydomain.com/index.php/my_controller/my_form1
- http://mydomain.com/index.php/my_controller/my_form2
- http://mydomain.com/index.php/my_controller/my_form3
- http://mydomain.com/index.php/my_controller/my_form4

I need to rewrite only this 4 pages like this

- http://mydomain.com/my-new-url-form1.html
- http://mydomain.com/my-new-url-form2.html
- http://mydomain.com/my-new-url-form3.html
- http://mydomain.com/my-new-url-form4.html

(there is no other pages with this site)

I created a HTACCESS

Code:
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteBase /

RewriteRule RewriteRule ^my\-new\-url\-form1\.html$ /index.php/my_controller/my_form1 [L]
RewriteRule RewriteRule ^my\-new\-url\-form2\.html$ /index.php/my_controller/my_form2 [L]
RewriteRule RewriteRule ^my\-new\-url\-form3\.html$ /index.php/my_controller/my_form3 [L]
RewriteRule RewriteRule ^my\-new\-url\-form4\.html$ /index.php/my_controller/my_form4 [L]

I have always a 404 error page generated by codeIgniter (like if he does not find the good controller or good method) and no 404 error page generated by Apache

Do you have an idea ?

thank you
#2

[eluser]toopay[/eluser]
Then, you need to remove 'index.php' from your url, adding some URL suffix then create a route for each page. Read about CI uri here, and about routing here




Theme © iAndrew 2016 - Forum software by © MyBB