Setting Permalinks in wp_config or functions file?

You can customize permalink by using WordPress Rewrite_API in function file.
See on codex