GoreDefex
GoreDefex

Reputation: 1531

Wordpress permalink adding "/" before index gate

I am having some trouble with wordpress and its permalink system. I need to change how it automatically adds a "/" character before its $_GET variables in the permalink section.

I am using an mvc pattern and require all $_GET requests go through the index gate to be validated before allowing it to be used and change the page. All should be fine but when a url looks like anything.com/index.php/?var=blah breaks the page and I get console errors mentioning I have an unexpected ">" in all my javascript files being called. If I go into the url bar and remove the "/" after index like so anything.com/index.php?var=blah the page loads like normal.

I need to fix the permalinks so each custom post type and tax all lead to index.php? not index.php/?

Upvotes: 0

Views: 71

Answers (2)

GoreDefex
GoreDefex

Reputation: 1531

Normally I don't answer my own questions but I thought it neccessary here. To anyone else who has a momentary lapse in brain power as well... this problem was solved by removing the "index.php" from my permalinks tab in wordpress admin panel. It required no extra code at all lol.

So now the urls show up like anything.com/?var=blah without the index.php and the pages load fine since the index is implied at the "/" root anyway. When I was getting anything.com/index.php/?var=blah it seems to have been trying to find a sub directory within the index file itself.

Upvotes: 0

Shane Lessard
Shane Lessard

Reputation: 655

https://codex.wordpress.org/Plugin_API/Filter_Reference/the_permalink

If you know how to work with wordpress hooks, this would be the filter you're looking for to alter the behavior of the permalinks.

Upvotes: 2

Related Questions