php - Codeigniter htaccess redirections not redirecting to desired url -


i have codeigniter website want seo on. used routes sluggish urls rather codeigniter default having method name , indices. problem comes in play, 3 different urls opens same page ie.

1. https://www.example.com/seo-freindly-url/ 2. https://www.example.com/index.php?/controller/method/42 3. https://www.example.com/controller/method/42 

but want first url work, others want redirect seo friendly 1 using htaccess redirections. please me in that. 1 more thing used htaccess 301 redirection redirect 1 of urls

redirect 301 "/plan/index/42" https://www.example.com/services/seo 

it works extent, whenever open url

https://www.example.com/plan/index/42 

it redirects

https://www.example.com/services/seo?/plan/index/42  

but has https://www.example.com/services/seo/

thank you.

it's hard test on end, might try this:

.htaccess

rewriteengine on rewritebase /  rewriterule ^controller/method/42$ /seo-friendly-url [l]  redirect 301 /plan/index/42 /services/seo  rewriterule ^(system|application|cgi-bin) - [f,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d  # remove index.php urls rewriterule .* index.php/$0 [pt,l] 

/application/config/config

// assumes want remove index.php urls $config['index_page'] = ''; 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -