Jump to content

HEADER LOACTION To Different Directory


Go to solution Solved by Frank_b,

Recommended Posts

Hi, 

There is nothing in the .htaccess that goes to 'actions'

 

RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?user=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ profile.php?user=$1

However, the page that the script is on is within the /actions directory.

 

Thanks,

In addition to what Frank already said:

 

 header('Location: www.website.com/username'); goes to www.website.com/actions/username

 

It doesn't. The URL points to a subdirectory in the current path. The www.website.com part is not interpreted as a domain.

 

Unfortunately, modern browsers hide all the technical details and accept pretty much any input into the URL bar, so people start to forget how an URL actually looks like. An absolute Internet URL consists of a scheme, a host and a path:

https://example.com/foo/bar

If you leave out the scheme, you get a relative URL which only consists of a path. So just writing down www.google.com does not get you to Google. It's interpreted as a (relative) path on your own site, which is probably not what you want.

 

So, yes, the “https://” or “http://” is significant. However, you can leave out the scheme if you want to use the current one:

//example.com/foo/bar

For an HTTPS URL, this would point to https://example.com/foo/bar, for an HTTP URL, it would point to http://example.com/foo/bar.

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.