I am trying to set up a rewrite rule so that anything after localhost/test/{this} gets forwarded to localhost/test/index.php?{here}
I have access to the server and configuration currently looks like this:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /var/www/test/>
AllowOverride All
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ index.php?$1
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
But at the moment, instead of showing /localhost/test/index.php?something when visiting localhost/test/something it shows localhost/index.php so it’s rewriting to the wrong place.. any ideas? Thanks
Resolved.. I found that whenever I included AllowOverride All it redirected to /index.php, then spotted I’d left a .htaccess file in there from testing earlier that was messing things up. Removed, updated my rule and now working. Thanks for help!