function multipurpose_zymphonies_theme_preprocess_page(&$vars) {
$header = drupal_get_http_header("status");
if ($header == "404 Not Found") {
$vars['theme_hook_suggestions'][] = 'page__404';
}
elseif ($header == "403 Forbidden") {
$vars['theme_hook_suggestions'][] = 'page__403';
}
}
I am using this above code to redirect the 404 and 403 to custom pages
but
nothing happens. I have created two files: page--404.tpl.php and
page--403.tpl.php in my theme templates folder
if i simply write in the url "http://example.com/readme" then its show 404 which is custommize by me but when i write like "http://example.com/readme.txt" then its show
Not Found The requested URL "/readme.txt" was not found on this
server.
and for other error forbidden access when i write in the url like "http://example.com/%7C~.aspx"
Access forbidden! You don't have permission to access the requested
object. It is either read-protected or not readable by the server. If
you think this is a server error, please contact the webmaster. Error
403
I want to handle all these error for custom pages
You can configure default error pages through configuration from the url :
yoursite/admin/config/system/site-information
Administration > Configuration > System > Site information
Related
In my App i don t need a registration feature so i added a user in the database manually ,Actually I tried with the LexiJWTAuthenticationBundle i followed the documentation but unfortunately when I use the cURL to send a request i get the following error
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<hr>
<address>Apache/2.4.52 (Win64) OpenSSL/1.1.1m PHP/8.1.4 Server at localhost Port 443</address>
</body></html>```
**the cURL request is
curl -X POST -H "Content-Type: application/json" https://localhost/api/check_login --data '{"email":"johndoe#gmail.fr","password":"test"}' -k
Moreover frankly i m confused about the logic of the bundle so im worried if i need a controller or not .
However in the frontENd i m using reactJS i just sent a post request using axios
but when i hit submit in the network when i inspect i get
{
"code": 401,
"message": "JWT Token not found"
}
I think documentation is only showing an example. Not sure if that works out of the box because after installing it, I haven't seen a new Controller to handle the login_check route. In fact, ask to add the route manually, without referring a resource.
To generate a Token from a user, in a controller you will need to instantiate Jwt.
// src/Controller/AuthController.PHP
use App\Entity\User;
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface;
class AuthController
{
private JWTTokenManagerInterface $jwt;
public function __construct(JWTTokenManagerInterface $jwt)
{
$this->jwt = $jwt;
}
#[Route(path: '/token', name: 'api_auth_token')]
public function login(Request $request): Response
{
// Code to retrieve your user
// [...]
// User must extends UserInterface for Lexik to work properly
$token = $this->jwt->create($user);
// return the token
}
This code will show you how to create the token, but not to login. You will have to check your authentication flow.
Side note: Don´t confuse hashing the password with generating a token. You will need to do both things separately
I recommend you to look for the service you need by exploring autowirng:
php bin/console debug:autowiring jwt
I'm using Solr extension with TYPO3 9.5.3 and I couldn't index the Pages, I get this error https://imgur.com/1e6LfIy
Failed to execute Page Indexer Request. Request ID: 5d78d130b8b4d
When I look at the Solr log, I see that Typo3 add &L=0 to the request URL, the pages with &L=0 return '404 page not found' error :
request url => 'http://example.com/index.php?id=5&L=0' (43 chars)
I added the following code to my TS setup, But that did not work and the request url always ends with &L=0
plugin.tx_solr.index.queue.pages.fields.url.typolink.additionalParams >
I'm not sure that's the only reason solr doesn't index the pages (news can be indexed without any problem), but first, how can I solve the problem and remove &L=0 from request URL in Solr ?
Can you check your TypoScript if you have a configuration like
config.defaultGetVars.L = 0
or if other old language settings exist
I
m not dure, but have you an older languge-Configuration where you Deine the language-Parameter deines?
As User#1, we're using this API to create a shared link:
https://graph.microsoft.com/v1.0/drives/{{driveId}}/items/{{itemId}}/createLink
This is successful and returns a ShareURI.
As User#2, we're using this API to get information about the item shared by User#1.
https://graph.microsoft.com/v1.0/shares/{{base64ShareURI}}/driveItem
However, /driveItem returns a status code of 403 with the following body:
HTTP 403
{
"error": {
"code": "accessDenied",
"message": "The sharing link no longer exists, or you do not have
permission to access it.",
"innerError": {
"request-id": "73e65e0a-54b8-4722-9726-82297076276e",
"date": "2018-11-07T16:20:03"
}
}
}
To prevent this 403 from happening, User#2 needs to load the ShareURI in a web browser. Once User#2 does this, then the request to the exact same URI
https://graph.microsoft.com/v1.0/shares/{{base64ShareURI}}/driveItem
return 200OK and the expected json body.
Why does User#2 have to load the ShareURI in a browser before being able to use Graph APIs on that ShareURI? Is there a workaround?
To open it directly without visiting link just add header Prefer with value redeemSharingLink to request https://graph.microsoft.com/v1.0/shares/{{base64ShareURI}}/driveItem.
Docs:
redeemSharingLink should be considered equivalent to the caller navigating to the sharing link the browser (accepting the sharing gesture)
Reference: https://learn.microsoft.com/en-us/graph/api/shares-get?view=graph-rest-1.0&tabs=javascript
I'm experiencing an issue with urlfetch. Seems that for the URL used in the code, follow_redirects=True works only locally.
Here's the code I used for testing:
def redirect_test():
url = 'http://0214.by/job.php?busy=ПОСТОЯННАЯ'
response = urlfetch.fetch(url, follow_redirects=True)
if 'location' in response.headers:
ret = 'redirect ignored. location: %s<br>' % response.headers['location']
url = urlparse.urljoin(url, response.headers['location'])
response = urlfetch.fetch(url, follow_redirects=False)
if 'location' in response.headers:
ret += 'redirect followed manually and another redirect response received'
else:
ret += 'redirect followed manually and no more redirects received'
else:
ret = 'redirect followed automatically'
return ret
The problem is that when I'm running this code locally I'm always getting the "Redirect followed automatically" message. When deployed on google app engine, the "Redirect followed manually and no more redirects received" message is always shown.
The URL returns a redirect to https page.
It makes me think the redirect is followed as expected only when running locally for some reason. I would appreciate any ideas on what this could be caused by.
I have created used car website www.carsangrah.com using osclass.
Some links (http://www.carsangrah.com/buy-used-cars_maharashtra-r781510) are working perfect but returns broken link (404 error) when checked on http://validator.w3.org/checklink.
Google and Bing webmaster also showing as 404 error. I am not able to index these links in Google and Bing. Please suggest a solution.
Thanks
Here is the solution got to oc-includes/osclass/controller then search.php then find this
if( count($aItems) === 0 ) {
header('HTTP/1.1 404 Not Found');
}
replace if( count($aItems) === 0 ) with if( count($aItems) === -1 ).
that fixes
Osclass by default if a search have 0 results it returns 404 status code, you don't want to search engines index pages without any useful content.
If a link, results on a search results page with listings, 200 status code is returned.
Ah that explains the 404 issues I am seeing. I am going to log this as and error as no listings returned does not mean 404 it means no listings. 404 is page not found which is clearly wrong as the server is delivering a html page from the server.