How can I set something to the URL by PHP? [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to set something to the URL when the page is loading ... How can I do that?
When you open this URL:
http://stackoverflow.com/questions/38839016/should-i-store-the-result-of-an-function
automatically it will be replaced with this:
http://stackoverflow.com/questions/38839016/should-i-store-the-result-of-an-function-into-an-array
How does SO do that?
Note: I've disabled JavaScript on the browser, still that replacement happens. So it is done by PHP.

It's a simple HTTP redirect. Each question has a slug. When the post slug doesn't match with the slug segment of the url, the HTTP controller redirects the page to the correct route.

You can define many rules about rewriting the url address in apache .htaccess file. There magic happens.
You can look in more detail how to define rewrite rules in .htaccess here.

Related

Website posting and login [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
How can I make website where the moderator will be able to publish a post or an image without accessing to the code. To publish something like a facebook status from some part of site. And second question, who can I make that someone can login to my site(moderator/administrator), I know how to make login form but just visualy withaout some functionality. Thanks
(I know HTML, CSS, JavaScript)
You seem to be talking about a Content Management System. I'd suggest you look at some of the (many) options out there
e.g. Wordpress or Drupal - neither is perfect but both are widely supported.

HTML Title From json - SEO Friendly Way? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Changing the page title using jQuery, changes the title on the load of the page - but is there a SEO friendly way to do this?
My data is coming from json and I am handling it in jQuery.
document.title = 'test';
No, bots will only see the static title of the page as it is served by the webserver. Nothing you do in JavaScript will have any effect on that data. Furthermore, your approach is unfriendly to any browser with no JavaScript, making it wholly inaccessible.
You should control your title on the server; perhaps with a PHP script?!

Hide certain pages on website [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
There are some pages on my website where I don't want users to know the address of the certain page there on, is there any way to make it so that when they go to this certain page it will just be like www.example.com/# or something like that?
You can just redirect them with the location header. I should note that if it is in the public_html folder of your web server, then its NOT SECURE, by any means, no matter what php code you put ahead of the file.
To hide a file/path just put it one folder before the public docs and access it from there.
Insert this into the start of your page.
<?php header('Location: yourdomain.url');
exit(); //Thanks Drixson OseƱa
?>

RESTful Commit to Github file [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I've been looking for quite some time if it is even possible to do this.
I'd like to make a RESTful POST call with a javascript without the use of a server (node) to send a json object in the request body to update a json file in a github repo triggering a commit/push.
Yes, it's possible to do this using the Github API.
The URL must be something like that:
https://api.github.com/repos/{repositoryName}/contents/{path}
repositoryName is the repository where you want to put your file and path its path within this repository.
Regarding the authentication, you need to follow this link https://developer.github.com/v3/#authentication. I successfully tested with basic auth.
You need then to use an HTTP method PUT with content with the following structure:
{
"message": "a commit message",
"content": "bXkgbmV3IGZpbGUgY29udGVudHM="
}
The field content corresponds to the content of your file encoded with base 64.
Hope it helps.
Thierry

Adding a language code in my URL [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i have been advised to add a language code to my url - therefore i want my homepage to read http://www.freebetoffersonline.com/en/index.php instead of http://www.freebetoffersonline.com/index.php therefore can somebody please assist me??
do i have to change the html in order to add this
my suggestion is to use an get object lang=en/other language code like http://www.freebetoffersonline.com/index.php?lang=en this is easier.
I suggest same as '.Madan Ram' http://www.freebetoffersonline.com/index.php?lang=en.
Or you can make a folder named 'en' and put your whole web site in that folder. This will help you to create different folders for different languages. But you have to make a copy of whole web page again and again regarding the language in every folder. And this is bulky.

Categories

Resources