Saturday, 15 February 2014

.htaccess - How it works: Htaccess Rewrite Engine? -



.htaccess - How it works: Htaccess Rewrite Engine? -

i have next .htaccess file:

options +followsymlinks rewriteengine on rewriterule ^mangas/([^/]+)/([^/]+)/$ - [f,l] rewriterule ^mangas/([^/]+)/$ - [f,l] rewriterule ^mangas(/?)$ - [f,l] rewriterule ^([^/.]+)/([^/.]+)/([0-9]+)(/?)$ index.php?manga=$1&chapter=$2&page=$3 [l] rewriterule ^([^/.]+)/([^/.]+)(/?)$ index.php?manga=$1&chapter=$2 [l] rewriterule ^([^/.]+)(/?)$ index.php?manga=$1 [l]

but happens when go link following: /manga/name_of_manga gives me 404 not found error. htaccess file not rewriting index.php?manga=$1 this: /manga/name_of_manga ?

basically, in form of index.php?manga=$1 converted /manga/name_of_manga , should still display stuff. if go straight using index.php method, works fine.

for example, these work: http://neoblizz.net/manga/?manga=tower%20of%20god http://neoblizz.net/manga/index.php?manga=tower%20of%20god

these don't: http://neoblizz.net/manga/tower_of_god/ http://neoblizz.net/manga/tower%20of%20god/

154.20.109.65 - - [03/jul/2014:18:28:50 -0400] "get /manga/ http/1.1" 500 - neoblizz.net "-" "mozilla/5.0 (macintosh; intel mac os x 10_9_3) applewebkit/537.36 (khtml, gecko) chrome/35.0.1916.153 safari/537.36" "-" 154.20.109.65 - - [03/jul/2014:18:28:51 -0400] "get /manga/ http/1.1" 500 - neoblizz.net "-" "mozilla/5.0 (macintosh; intel mac os x 10_9_3) applewebkit/537.36 (khtml, gecko) chrome/35.0.1916.153 safari/537.36" "-" 154.20.109.65 - - [03/jul/2014:18:28:52 -0400] "get /manga/ http/1.1" 500 - neoblizz.net "-" "mozilla/5.0 (macintosh; intel mac os x 10_9_3) applewebkit/537.36 (khtml, gecko) chrome/35.0.1916.153 safari/537.36" "-" 154.20.109.65 - - [03/jul/2014:18:28:52 -0400] "get /manga/ http/1.1" 500 - neoblizz.net "-" "mozilla/5.0 (macintosh; intel mac os x 10_9_3) applewebkit/537.36 (khtml, gecko) chrome/35.0.1916.153 safari/537.36" "-"

have way:

options +followsymlinks rewriteengine on rewritebase /manga/ rewritecond %{request_filename} -d [or] rewritecond %{request_filename} -f rewriterule ^ - [l] rewriterule ^mangas/([^/]+)/([^/]+)/?$ - [f,l] rewriterule ^mangas/([^/]+)/?$ - [f,l] rewriterule ^mangas/?$ - [f,l] rewriterule ^([^/]+)/([^/]+)/([0-9]+)/?$ index.php?comic=$1&chapter=$2&page=$3 [l,qsa] rewriterule ^([^/]+)/([^/]+)/?$ index.php?comic=$1&chapter=$2 [l,qsa] rewriterule ^([^/]+)/?$ index.php?comic=$1 [l,qsa]

.htaccess mod-rewrite

No comments:

Post a Comment