Forum Moderators: phranque
I have a website where customers place ads.
The actual link from within the website would be, as an example:http://www.mysite.com/listingview.php?listingID=17
or
http://www.mysite.com/listingview.php?listingID=18
and so on....
I would like to shorten the link to something like:
http://www.mysite.com/listingID=17 automatically
So that if the advertiser has a newspaper ad they can include the simple internet link http://www.mysite.com/listingID=17 in the add rather than
the more difficult:
http://www.mysite.com/listingview.php?listingID=17
Does that make sense? Is this possible using a script, php, or htaccess?
NYColt
That did not work.
Would I call it like this: [listing.mysite.com...]
I have some sub domains in my htaccess too.
This is what I have now. Does this look like it should work?:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} nycapital.mysite.com
RewriteCond %{REQUEST_URI}!nycapital/
RewriteRule ^(.*)$ nycapital/$1 [L]
RewriteCond %{HTTP_HOST} tampa.mysite.com
RewriteCond %{REQUEST_URI}!tampa/
RewriteBase /
RewriteRule ^listing/([0-9]+) listing.php?newsID=$1
[mysite.com...]
I was just trying to show that I do have other rewrite rules in my htaccess file. is that ok?
Is there anything else I should need to do to get this to work other than add that line of code to my htaccess file? Like do I need to to create a directory called Listing or anything like that? Also my htaccess should be in my httdocs correct?
Thanks
NYColt
Got this to work.
RewriteCond %{REQUEST_URI} ^/([0-9]+)$
RewriteRule ^(.*) /listingview.php?listingID=%1 [L,R]
which works with:
[mysite...]
VERY easy!
Thanks for the look and see on this issue.
Hope the thread can help someone else down the road.
NYColt