Friday, January 28, 2011

Need a Mod rewrite regex solution for .htaccess

I moved my site to different server since then my all urls started showing up 404 error.

earlier my all urls were like this mysite.com/title-of-url

but now all such urls are getting 404 error, so i disabled seo friendly url feature on site admin and now i can access same page on mysite.com/index.php/title-of-url

i tired to create some regex for .htaccess to do purpose like RewriteRule ^([^/.]+)/?$ /index.php/$1 [L]

but its working fine one depth of "/", i mean its working for mysite.com/first but not for mysite.com/first/second

I am looking for REGEX help regardng it so that mysite.com/first/second should gets rewritten to mysite.com/index.php/first/second as well as mysite.com/something gets rewritten to mysite.com/index.php/something..

looking forward for your kind help Thanks

  • Perhaps this would do the trick?

    RewriteCond  %{REQUEST_URI}  !^/index\.php
    RewriteRule  ^/(.*)/?$       /index.php/$1  [L]
    
    From mark

0 comments:

Post a Comment