Sign in to follow this  

[web] redirecting and hiding the URL

This topic is 2847 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to mask the actual URL at what my page is (domain.com&arglistblah) and substitute it with something more sensible (eg domain.com/friends). The only way of accomplishing this (edit: that I can think of, that is :D) is by creating a redirect page. By using a simple php redirect script I can get things working and they look nice, but the browser still displays the ugly URL in the address bar. By using IFRAMEs/FRAMEs I can avoid that, but that generates a white border around the frame and the frame flashes white when loading from a non-framed page. Right now this seems like a dead end either way to me. Can anyone suggest something else I could try that would mask the url AND get rid of the flash? [Edited by - irreversible on February 26, 2010 8:42:45 AM]

Share this post


Link to post
Share on other sites
Sorry, I'm a bit daft when it comes to web stuff (only reason I'm messing with this is that it's my personal website), but here's a more detailed description:

I'm using Wordpress and WP generates URLs in the format "http://www.domain.com&page_id=30". However, I want the address bar to display "http://www.domain.com/stuff" instead while the contents of the page that is displayed is still from WP's page_id=30.

I'm not sure URL rewriting would help me (becuase I'm concerned with the name in the address bar) and additionally I'm purchasing webspace and I'm not quite sure how to go about using/setting up URL rewriting from a consumer's standpoint.

Using IFRAMEs takes care of this -

index.html in subfolder "stuff":

<iframe src ="http://www.domain.com&page_id=30" width="100%" height="300">

Your browser does not support iframes.


</iframe>


However, it also produces a white border around the frame (visible client area), at least in Firefox, and when loading index.html, the frame's content is erased (filled with white), causing the broweser to flash white for a brief moment before the frame is displayed.

Using PHP redirection avoids the flash, but doesn't provide a workawround for the displayed URL in the address bar:

index.html:

<?php header( 'Location: http://www.domain.com&page_id=30' ); ?>

Share this post


Link to post
Share on other sites
Quote:
Original post by irreversible
I'm not sure URL rewriting would help me (becuase I'm concerned with the name in the address bar)

That's what URL rewriting is for.
Quote:
and additionally I'm purchasing webspace and I'm not quite sure how to go about using/setting up URL rewriting from a consumer's standpoint.
Ask your provider.

Share this post


Link to post
Share on other sites
Just to confirm what Sneftel is saying, you're after URL rewriting.

Quote:
from WordPress Codex: Using Permalinks
mod_rewrite: "Pretty Permalinks"

Using mod_rewrite or lighttpd you can produce much nicer permalinks (see Pretty Permalinks). There are many different formats, but the most common, and most versatile looks like
Quote:
http://example.com/category/post-name/
or http://example.com/year/month/day/post-name

Some people eliminate some or all of the date elements (day, month, year) to have a shorter permalink format.

Pretty permalinks are available under
  • Apache web server with the mod_rewrite module

  • Microsoft IIS 7+ web server with the URL Rewrite 1.1+ module and PHP 5 running as FastCGI

  • Microsoft IIS 6+ using ASAPI_Rewrite or a 404 handler or Mod-Rewrite Pro

  • Lighttpd using a 404 handler or mod_rewrite or mod_magnet (see External sources)
The links on that page should give you more information to get started. You'll need to talk to your hosting provider if the required options aren't provided by default.

Share this post


Link to post
Share on other sites
Alrighty - I got almost everything up and running. At least WordPress is using custom permalinks via URL rewriting now so it seems to be working.

Last thing I'm having some trouble with (and I know this should probably rather go in the WP support forum) are static links to WP pages that I've manually placed in my theme source code:

if I use the WP default indexed format (&page_id=X) the links work but don't get rewritten (eg I can still see the ugly format in the address bar when navigating from my static links). I understand I need to add something extra to .htaccess, but I'm not sure what it is. Current file contents, as provided by WP:


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


Or, once again, I could be daft enough to be missing something obvious, so don't be shy to point it out :)

Share this post


Link to post
Share on other sites

This topic is 2847 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this