Category Redirects to homepage [closed]
Fixed. There was conflict between slugs, which was hard to see at first, because project is large. 😀 Thanks.
Fixed. There was conflict between slugs, which was hard to see at first, because project is large. 😀 Thanks.
If it’s a standard WordPress .htaccess file that won’t be your problem. I’m willing to bet you forgot to change the Site URL values when you imported the database. You can either edit it in the options table in your database or even in your wp-config file by adding define(‘WP_HOME’, ‘http://mainwebsite.com/test’); define(‘WP_SITEURL’, ‘http://mainwebsite.com/test’); to it. … Read more
You can actually change them in Settings -> Permalinks and it will change the link that generated for the post. And if you still be unhappy with result you can remove WordPress rewrite rules for dates with date_rewrite_rules filter. UPDATE: In this case, you can use post_rewrite_rules to keep the date to post rule working … Read more
Not really a WP-specific question, but I’ll help you out. That regex will match ex.com/helloworld/ but not ex.com/helloworld. To handle both you’d want RewriteRule ^helloworld/?$ /careers/helloworld-recruiting/ [L,R=301] The question mark makes the preceding token optional and the single slash rather than double in the rewritten URL makes it relative to the root.
No, it’s not. Single quotes can’t cause redirects.
So I’m not sure why that RewriteRule returned a 404 error for you, because I’ve tested it and it did work as expected — if permalinks are actually enabled, you would be redirected to the actual post permalink. And here’s the content of my .htaccess file: RewriteEngine On RewriteRule ^go/(\d+)$ /?p=$1 [R=302,L] # BEGIN WordPress … Read more
To achieve this you don’t need the .htaccess in the servers directory itself. You can remove this and apache can use rules in the root WordPress .htaccess to do the rewrite you need, and you can usefully keep rewrite rules for your site in one place. You need a couple of rules to make this … Read more
As far as I know, the few files that you are talking about are always going to be the same, that means you can add exceptions to your .htaccess and “let them go through the cracks”. With an example of code from what you wrote so far may help us direct you on how to … Read more
a) Would that work, and b) would this code be an acceptable way of doing it? Yes. But you should put the custom directive (the Redirect line) above the BEGIN marker, i.e. the # BEGIN WordPress line, because if not, then your custom directive will be gone when the WordPress rewrite rules are flushed/regenerated. So: … Read more
This should work for you- function wpse28906_rewrites_init(){ add_rewrite_rule( ‘mypage/([^/]+)/?$’, ‘index.php?pagename=mypage&myslug=$matches[1]’, ‘top’ ); } add_action( ‘init’, ‘wpse28906_rewrites_init’ ); function wpse28906_query_vars( $query_vars ){ $query_vars[] = ‘myslug’; return $query_vars; } add_filter( ‘query_vars’, ‘wpse28906_query_vars’ ); You can then use get_query_var( ‘myslug’ ) in your template to get your slug value. Don’t forget to flush your rewrite rules after adding … Read more