Commit 53ad356 1 parent 0f08676 commit 53ad356 Copy full SHA for 53ad356
File tree 1 file changed +10
-10
lines changed
1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -304,17 +304,17 @@ private function get_rules()
304
304
305
305
// Generate RewriteRules
306
306
foreach ($ short_urls as $ url ) {
307
- $ short_url_path = trim (wp_parse_url ($ url ['shorturl_generated ' ], PHP_URL_PATH ), '/ ' );
308
- $ long_url = $ url ['long_url ' ];
309
-
310
- $ ret .= "RewriteRule ^ $ short_url_path$ $ long_url [R=303,L,NE] \n" ;
311
-
312
307
if (!empty ($ url ['shorturl_custom ' ])){
313
- $ short_url_path = trim (wp_parse_url ($ url ['shorturl_custom ' ], PHP_URL_PATH ), '/ ' );
314
- $ long_url = $ url ['long_url ' ];
315
-
316
- $ ret .= "RewriteRule ^ $ short_url_path$ $ long_url [R=303,L,NE] \n" ;
308
+ $ parsedUrl = parse_url ($ url ['shorturl_custom ' ]);
309
+ $ short_url_path = trim ($ parsedUrl ['path ' ]);
310
+ $ long_url = $ url ['long_url ' ];
311
+ if (empty ($ short_url_path )) {
312
+ continue ;
313
+ }
314
+
315
+ $ ret .= "RewriteRule ^ $ short_url_path$ $ long_url [R=303,L,NE] \n" ;
317
316
}
317
+
318
318
}
319
319
} catch (Exception $ e ) {
320
320
echo "Error: " . $ e ->getMessage ();
@@ -392,4 +392,4 @@ private function updateHtaccess(): void
392
392
$ shortURLRedirect ->handleRequest ();
393
393
exit ;
394
394
395
- ?>
395
+ ?>
You can’t perform that action at this time.
0 commit comments