Jump to content

HEADER LOACTION To Different Directory


slj90

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.