Forum Moderators: phranque

Message Too Old, No Replies

Remove a directory from URL

         

sicsiksix

2:59 pm on Jan 21, 2011 (gmt 0)

10+ Year Member



Hi,

I've been looking through various forums and websites looking for the solution to my problem and I've tried various things but just can't get this to work as expected.

We are building a new adwords campaign and I wish to create some new landing pages, and to keep the server tidy I am looking to keep all of the newly created adwords only pages in a folder called 'adw'.

The thing I am looking to do is have visitors land on the page www.example.com/adw/widget.php and see the url as www.example.com/widget.php

I have tried solutions from all over the web, but either nothing happens, the page 404's or the rest of the site stops functioning.

For reference, the rest of the website is located in the root and it is only the folder name 'adw' that I wish to be rewritten.

Is this possible? If so, how do I do it? and would the .htaccess file be in the website root or the folder itself?

Thanks,
Sicsiksix

g1smd

8:24 pm on Jan 21, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The URL as clicked on in the link *IS* the URL.

You either redirect requests for /adw/widget.php arriving at the server instructing the browser to make a new request for a different URL (such as /widget.php) OR you set up an internal rewrite so that requests for /adw/widget.php are served the content at the URL that was requested, the rewrite pulling the content from a different place from within the server.

jdMorgan

10:37 pm on Jan 24, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Terminology is critical to understanding...

"The thing I am looking to do is have visitors load the file /adw/widget.php when requesting the URL www.example.com/widget.php"
 
# Internally rewrite requests for URL-path "widgets.php" to filepath "/adw/widgets.php"
RewriteRule ^widget\.php$ /adw/widget.php [L]

Jim