0

Here is a sample URL with query string. The keyword is anything that User Search in my website or redirect from other websites, search engines etc.

http://example.com/search.php?q=keyword

and the equivalent CodeIgniter URL

http://example.com/search/now/keyword (search = controller and now = method)

How to Rewrite the URLs in Apache .htaccess to create URLs like CodeIgniter?

1
  • Are you sure this is what you want? Commented Jun 6, 2011 at 18:13

2 Answers 2

1
RewriteRule ^/?search/now/(.*)$ /search\.php?q=$1

OR you can hide url query

RewriteRule ^search.php?id=(.*)$ /search.php [L,R=301]
Sign up to request clarification or add additional context in comments.

Comments

0

Firstly you don't want to be pointing to a php file. CI only has index.php, If you are desperate you could point all search.php to index.php...

I'd approach it on this basis...

POST the form to the controller, use form validation to make the input safe the take the variable and use the redirect function like this

redirect('/search/'.$this->input->post('q') );

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.