php - Add real path in url rewritting -


when try rewritte url, , access test page ( test.php ) , in url real path add, so, have 404 error.

http://mywebsite.fr/home/web/dev/test/ <- /home/web/ real path , can't add url.

in configuration, have writting :

<virtualhost *:80>         serveradmin webmaster@localhost          servername *         serveralias *          documentroot /home/web         <directory />                 options followsymlinks                 allowoverride none                 directoryindex index.php         </directory>         <directory /home/web/>                 options indexes followsymlinks         allowoverride                 order allow,deny                 allow                 directoryindex index.php         </directory> 

in htaccess :

rewriteengine on rewritecond %{request_filename} !-f rewriterule ^([^\.]+)$ $1.php [nc,l] rewriterule ^([^\.]+)$ $1.html [nc,l] 

if want add extensions urls .php or .html remove shown rules .htaccess , add line:

options +multiviews 

option multiviews used apache's content negotiation module runs before mod_rewrite , makes apache server match extensions of files. /file can in url serve /file.php.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -