.htaccess - htaccess rule to rename .php to .html is interfering with other rules -


i attempting change .php files .html extensions , rule using interfering other rules in .htaccess file. appears can either 1 set of rules work or other.

check code:

options +followsymlinks rewriteengine on  ##locations pages rewriterule    ^([^/\.]+)\.html?$                           locations.php?locationslug=$1&submit=submit                 [l]  ##listing pages rewriterule    ^([^/\.]+)\/([^/\.]+)\.html?$                listings.php?locationslug=$1&categoryslug=$2                [l]  ##vendor pages rewriterule    ^([^/\.]+)\/([^/\.]+)\/([^/\.]+)\.html?$     vendors2.php?vendorslug=$3&locationslug=$1&categoryslug=$2  [l]  rewriterule ^(.*)\.html$ $1.php [l] 

if put line rewriterule ^(.*)\.html$ $1.php [l] 3rd line of file, flat .php pages work .html however, following rules throw error (404 not found).

if put line rewriterule ^(.*)\.html$ $1.php [l] last line, flat pages not work .html.

as always, constructive input appreciated. in advance!

try changing order of these rules specific generic ones this:

options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase /  ##vendor pages rewriterule ^([^/]+)/([^/]+)/([^.]+)\.html?$ vendors2.php?vendorslug=$3&locationslug=$1&categoryslug=$2 [l,qsa,nc]  ##listing pages rewriterule ^([^/]+)/([^.]+)\.html?$ listings.php?locationslug=$1&categoryslug=$2 [l,qsa,nc]  rewritecond %{request_filename}.php -f rewriterule ^([^/.]+)\.html?$ $1.php [l,nc]  ##locations pages rewriterule ^([^/.]+)\.html?$ locations.php?locationslug=$1&submit=submit [l,qsa,nc] 

just fyi rule # 3 , 4 both match same uri pattern.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -