Skip to content

Instantly share code, notes, and snippets.

View orkuncv's full-sized avatar

Orkun Çavdar orkuncv

View GitHub Profile
@orkuncv
orkuncv / .htaccess
Created October 6, 2022 12:30
Synchronise WordPress Uploads Across Environments
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp-content/uploads/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) https://CHANGEME.nl/wp-content/uploads/$1 [L,P]
</IfModule>
@orkuncv
orkuncv / url-rewrite-sql-query.sql
Created March 29, 2022 13:20
[Magento 2] Url rewrite sql query
INSERT INTO `url_rewrite` (`entity_type`, `entity_id`, `request_path`, `target_path`, `redirect_type`, `store_id`, `description`, `is_autogenerated`, `metadata`)
VALUES
('custom', 0, '$request_path', '$target_path', 301, $storeID, '29-03-2022 | Redirect import | FR | v1', 0, NULL),
@orkuncv
orkuncv / gist:bc5cd089479f6af53763bb9d61c16c24
Created March 23, 2022 08:17
Zet noindex, nofollow als URL een parameter bevat
<?php
$url = $_SERVER['REQUEST_URI'];
if (strpos($url,'?') !== false) {
echo '<meta name="robots" content="noindex, follow" />' . "\n";
}
?>
@orkuncv
orkuncv / Change url for sql [Wordpress]
Created December 23, 2021 09:11
change old url in Wordpress
UPDATE `ai_posts` SET guid = REPLACE(guid, 'oldurl', 'neworl') WHERE guid LIKE 'oldurl%';
UPDATE `ai_postmeta` SET meta_value = REPLACE(meta_value, 'oldurl', 'neworl') WHERE meta_value LIKE 'oldurl%';
UPDATE `ai_options` SET option_value = REPLACE(option_value, 'oldurl', 'neworl') WHERE option_value LIKE 'oldurl%';
UPDATE `ai_posts` SET post_content = REPLACE(post_content, 'oldurl', 'neworl') WHERE post_content LIKE 'oldurl';
@orkuncv
orkuncv / .zshrc
Last active October 10, 2025 10:19
[M2] Magento 2 zshrc config
# Personal
alias clearall="bash ~/htdocs/dev-scripts/clearall.sh"
alias clearall-theme="bash ~/htdocs/dev-scripts/clearall-theme.sh"
alias mem1="php -d memory_limit=-1"
alias ba="bin/accent"
alias pa="php artisan"
# Magento 2
alias bmsu="bin/magento setup:upgrade"
alias bmcc="bin/magento cache:clean"
@orkuncv
orkuncv / mysql commands for Oh My Zsh
Last active October 4, 2021 10:19
Handy mysql commands for Oh My Zsh import this gist in .zshrc [works only for mysql user 'root']
# Show local databases on user 'root'
alias mysd="mysql -u root -p -e 'SHOW DATABASES;'"
# Create new database on user 'root'
alias mycd='mysqlCreateDatabase'
mysqlCreateDatabase() {
PROGNAME=mycd
if [[ $# -eq 0 ]]; then