Jump to content

URL Masking


StormTheGates

Recommended Posts

Presumably you want to change the URL input by the user for "visual effect" - so that the end user sees (in their browser URL bar) the non-PHP parameterised version. Unfortunately this can only be done either by redirecting or by using javascript etc. to control the browser software. Since HTTP is a stateless transaction the browser will know nothing about any rewrites until a redirection is returned. The URL bar will therefore remain unchanged and the user will not see the benefit. If you simply rewrote without redirection back to the browser then the correct location would be accessed by the reference being rewritten a the server end - the user would know nothing about this.

 

Both search engines and user's visual observations would benefit from a redirect I suppose.

 

Yes it could be done using rewrite but - To actually redirect back to another location you might as well use PHP since you are redirecting from a PHP file anyway and can easily construct a header redirect to the uniform folder location. This location would need to host an INDEX.PHP file which then accepts any parameters etc. If no parameters then I'd say a simple INDEX.HTM in there would suffice.  Doing it using PHP means CPU time would only be used actually when a hit was made on that page. RewriteRules are processed all the time even if skipped and although the additional CPU overhead is tiny it could mount up on a busy server. Plus the following would be much easier to maintain and would avoid clashes with other rules.

 

For example - something like - (fictitious URL at date of posting)

 

<?

$city=$_GET['city'];

//Redirect - this causes the remote browser to update the URL bar and redirect the request back to the correct location

header("Location: http://www.oregon-bloods.com/$city/");

exit;

?>

 

Just a thought! ;)

Link to comment
Share on other sites

I am searching for a way to turn a url like this:

 

www.ny-mafia.com/city.php?city=Baltimore

 

Into this:

 

www.ny-mafia.com/Baltimore

 

RewriteRule ^([a-zA-Z\']+)$ city.php?city=$1 [NC,L]

 

This should work so that www.ny-mafia.com/Baltimore will load the page www.ny-mafia.com/city.php?city=Baltimore

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.