Forum Moderators: phranque

Message Too Old, No Replies

Please help me with this htaccess mod rewrite?

mod rewrite for wordpress and codeigniter

         

keitai

3:17 pm on Mar 2, 2010 (gmt 0)

10+ Year Member



Hi,

I am trying to get Wordpress and Codeigniter to work next to eachother with SEO/Permalinks enabled.

I am testing with this .htaccess but it doesn't do anything.



<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /projectz/domain.com/


#TEST just a rewrite test doesn't work
RewriteRule ^file/([0-9]+)/(.+)? /file.php?f=$1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#RewriteCond %{REQUEST_URI} !^/(jobs|ci|file) [NC]

RewriteRule . /projectz/domain.com/index.php [L]

#none of the following work
#TEST jobs/etc to a index.php in jobs folder

RewriteRule ^jobs/details/([0-9]+)/([^/]+)/ /jobs/index.php[L]
#redirect these url to one of our CI controllers
RewriteRule ^jobs2/([^/]+)/([^/]+)/([^/]+)? /ci/index.php[L]
RewriteRule ^profile/([^/]+)/([^/]+)/([^/]+)? /ci/index.php[L]


RewriteRule ^file/([0-9]+)? /projectz/domain.com/file/file.php?f=
$1[L]
RewriteRule ^file/([0-9]+)/(.+)? /projectz/domain.com/file/file.php?f=
$1[L]
#other request to our WP index.php
#with permalinks in mind

</IfModule>


The only thing working was the original WP .htaccess

jdMorgan

5:21 pm on Mar 2, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In cases where you've got a rule based only on "-f" and "-d" RewriteConds, that rule needs to go last, as it will rewrite *any* requested URL which does not resolve to an existing file or directory, usually to a script (as with WP).

Put your rules in order: All external redirects first, in order from most-specific patterns and conditions (fewest URLs affected) to least-specific, followed by all of your internal rewrites, again in order from most-specific to least.

It's not clear if this is the entire .htaccess file or just the new stuff. It's also not clear how your site's files and directories are laid out, how you're testing, and what URLs you are requesting, so "It doesn't work" tells us practically nothing. Because of that, the above general reply is all I can come up with.

Jim