I have a local virtual host site setup where I’m using an .htaccess file to rewrite and I’m having this weird issue when the pretty url (followed by the variable I want to pass through) is the same as my source php file the variable does not get sent. But when I upload to the live server everything is fine.
Is there some setting in my Virtual Host setup that missing that my live server hosting might have? I’d like to keep my pretty url the same as my source.php file and be able to test locally.
Here’s my .htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^about/(.*)$ /about.php?my_var=$1
Then in my about.php file I have:
<?php
if (isset($_GET['my_var'])) {
$my_var = $_GET['my_var'];
echo 'hello test: ' . urldecode($my_var);
}
?>
Locally, I get the about.php page as the source, but the ‘if’ doesn’t fire. When I use anything else in the pretty url, like ‘bout’ or ‘who’ everything works… source page is called for pretty url with the var passed through.
On the Live server (MT), I get the ‘if’ statement fired off just fine, with my variable passed through to my page.
Here’s my live test with the pretty-url.
Here’s my v-host on my OS X
# ----------------------------------
# PRETTY-URLS.COM
<VirtualHost *:80>
ServerName dev.pretty-urls.com
DocumentRoot "/Users/kaplan/Sites/pretty-urls.com"
<Directory "/Users/kaplan/Sites/pretty-urls.com/">
Options Indexes Multiviews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
# ----------------------------------
Any ideas on fixing my local Virtual host so that it will keep that variable and use the same name pretty-url vs source?
Just when I thought I was getting the hang of mod_rewrite