Pretty Search URLs (MU)
Enables pretty search URLs like /search/parameter and redirects old search query URLs.
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/kianbabai/pretty-search-urls/archive/refs/heads/main.zipDeclares an update source (your-github-repo-link (e.g., https://github.com/kianbabaabady/pretty-search-urls)), so updates arrive through the plugin's own updater.
Readme
Pretty Search URLs (MU)
A WordPress Must-Use (MU) plugin that enables clean, SEO-friendly search URLs like /search/term while providing robust security protection against common web attacks.
Description
This plugin transforms WordPress search URLs from the default query parameter format (?s=searchterm) to clean, pretty URLs (/search/searchterm). It also includes comprehensive security measures to detect and block malicious search queries that could compromise your site.
Key features:
- Converts search URLs to clean
/search/termformat - Automatically redirects old search query URLs to the new format
- Protects against Directory Traversal, LFI/RFI, SQL Injection, XSS, and Command Injection attacks
- Works as a Must-Use plugin for seamless integration
Installation
For Standard WordPress Installation:
- Download the
cst.phpfile - Upload it to your
/wp-content/mu-plugins/directory - If the
mu-pluginsdirectory doesn't exist, create it - Visit Settings > Permalinks in your WordPress admin and click "Save Changes" to flush rewrite rules
For WordPress Multisite:
- Download the
cst.phpfile - Upload it to your
/wp-content/mu-plugins/directory - The plugin will automatically activate network-wide
- Visit Settings > Permalinks and click "Save Changes" to flush rewrite rules
Usage
Once activated, the plugin works automatically. Any search on your site will be redirected to the clean URL format:
- Old format:
https://yoursite.com/?s=wordpress - New format:
https://yoursite.com/search/wordpress
The search functionality remains unchanged - this only improves the URL structure.
Security Features
The plugin includes comprehensive protection against various web attacks through malicious pattern detection:
Directory Traversal & File Inclusion Protection
Blocks attempts to access unauthorized files or directories:
../,..\,/etc/passwd,/proc/, etc.- PHP stream wrappers like
php://filter,data://,file:// - Remote file inclusion patterns like
http://,https://
SQL Injection Protection
Detects and blocks common SQL injection attempts:
- Quote marks (
',") used to break out of string literals - SQL comments (
--,#,/*) - SQL keywords (
SELECT,UNION,DROP, etc.) - Advanced techniques like time-based injections
Cross-Site Scripting (XSS) Protection
Prevents client-side script injection:
- Script tags (``)
- JavaScript protocols (
javascript:) - Event handlers (
onload=,onerror=, etc.) - HTML tags commonly used for XSS (
<img>,<svg>, `