Sunday 15 February 2015

How can I redirect /path/variables/ to rewrite to /index.php/path/variables/ in Apache 2.4? -



How can I redirect /path/variables/ to rewrite to /index.php/path/variables/ in Apache 2.4? -

i upgraded local development server apache 2.2 apache 2.4 (via mac os x 10.10 yosemite). localhost resolves expected next virtual host settings no longer work (returns not found - requested url /subdir not found on server.).

can please help me upgrade next apache 2.2 apache 2.4?

the goal redirect directories root using path variables. example: redirect /abc/def/ /index.php/abc/def/. index lone works fine. /abc/ or /abc/def/ (or subdirectory (path) no longer work.

<virtualhost *:80> servername mylocalsite.local serveralias www.mylocalsite.local mylocalsite_alt.local <directory /users/my_username/sites/mylocalsite/html> allowoverride none options require granted deny none <ifmodule mod_rewrite.c> options +followsymlinks -multiviews rewriteengine on rewritecond %{http_host} ^www\.(.*)$ [nc] rewriterule ^(.*)$ http://%1/$1 [r=301,l] # redirect /img/abc /img/index.php/abc rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^img/(.*) img/index.php/$1 [l] # redirect directories root using path variables # ex. /abc/def/ redirects /index.php/abc/def/ rewritecond %{request_uri} !=/server-status rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule (.*) index.php/$1 [l] </ifmodule> </directory> documentroot /users/my_username/sites/mylocalsite/html </virtualhost>

can see why not resolving correctly?

other debugging:

> ping mylocalsite.local ping mylocalsite.local (127.0.0.1): 56 info bytes 64 bytes 127.0.0.1: icmp_seq=0 ttl=64 time=0.115 ms ^c --- mylocalsite.local ping statistics --- 1 packet transmitted, 1 packet received, 0.0% packet loss round-trip min/avg/max/stddev = 0.115/0.115/0.115/0.000 ms > sudo apachectl configtest syntax ok > httpd -s virtualhost configuration: *:80 namevirtualhost default server sandbox (/private/etc/apache2/vhosts/virtual_hosts.conf:8) port 80 namevhost sandbox (/private/etc/apache2/vhosts/virtual_hosts.conf:8) alias sandbox port 80 namevhost mylocalsite.local (/private/etc/apache2/vhosts/virtual_hosts.conf:20) alias www.mylocalsite.local alias mylocalsite_alt.local serverroot: "/usr" main documentroot: "/users/my_username/sites" main errorlog: "/private/var/log/apache2/error_log" mutex default: dir="/private/var/run/" mechanism=default mutex mpm-accept: using_defaults mutex proxy-balancer-shm: using_defaults mutex proxy: using_defaults pidfile: "/private/var/run/httpd.pid" define: dump_vhosts define: dump_run_cfg user: name="_www" id=70 not_used group: name="_www" id=70 not_used

make sure next lines uncommented in httpd.conf:

loadmodule vhost_alias_module libexec/apache2/mod_vhost_alias.so loadmodule php5_module libexec/apache2/libphp5.so loadmodule alias_module libexec/apache2/mod_alias.so loadmodule rewrite_module libexec/apache2/mod_rewrite.so loadmodule vhost_alias_module libexec/apache2/mod_vhost_alias.so include /private/etc/apache2/extra/httpd-vhosts.conf # restart apache

php apache .htaccess virtualhost apache2.4

No comments:

Post a Comment