-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permalink return 404 #5
Comments
@g-kanoufi We've run into this when we didn't have rewrite rules in place in our DB. Have you set up rewrite rules for your site? For example, in our Once our rewrite rules are in place, we've successfully written functional and acceptance tests calling to URLs like http://localhost/post-1/ tests/_support/FunctionalTester.php class FunctionalTester extends \Codeception\Actor
{
use _generated\FunctionalTesterActions;
/**
* Add our permalink structure and setup rewrite rules
*
* @link https://github.com/lucatume/wp-browser/issues/190
*/
public function haveRewriteRules() {
$this->haveOptionInDatabase(
'permalink_structure',
'/blog/%postname%/'
);
$this->loginAsAdmin();
$this->amOnAdminPage( 'options-permalink.php' );
$this->seeOptionInDatabase(
[
'option_name' => 'rewrite_rules',
]
);
}
} tests/functional/PostTypesCest.php class PostTypes_Cest {
/**
* Set up the pages before we run our tests.
*
* @param FunctionalTester $I Instance of FunctionalTester.
*/
public function _before( FunctionalTester $I ) {
$I->haveRewriteRules();
}
public function blogPostRenders( FunctionalTester $I ) {
$this->check( $I, true, 'post', 'blog' );
}
/**
* Check whether a post type renders correctly (or doesn't)
*
* @param FunctionalTester $I Instance of the Functional Tester.
* @param boolean $shouldSee Whether the post type should render.
* @param string $post_type The post type we are testing.
* @param string $path The rewrite path of the post type.
*/
protected function check( FunctionalTester $I, bool $shouldSee, $post_type, $path = '' ) {
$path = $path ?: $post_type;
$post_title = $this->faker->words( 3, true );
$post_name = strtolower( str_replace( ' ', '-', $post_title ) );
$I->havePostInDatabase(
[
'post_title' => $post_title,
'post_name' => $post_name,
'post_type' => $post_type,
'post_status' => 'publish',
]
);
$I->amOnPage( "/$path/$post_name/" );
if ( $shouldSee ) {
$I->see( $post_title );
} else {
$I->seeResponseCodeIs( '404' );
}
}
} |
Hey i am using a fork of your docker-wp-browser, which is awesome, i do have a small issue where any frontend page(/pagename) is giving me a 404 treatment, being not that qualified in docker, i would presume it comes from mod_rewrite not beign enabled.
On my fork, i have added:
in the entrypoint file, but i can't seem to resolve my issue.
If you have any idea that could help that will be very welcome of course.
Thank you,
--
Guillaume
The text was updated successfully, but these errors were encountered: