Hot answers tagged

4

SOLVED! Thanks to you guys. Solution: # Turn Rewrite Engine On RewriteEngine on # Set the base to /games/ so we need not include it in the rules RewriteBase /games/ #Rewrite for achilles.php?games_path=xxxxxxxxxx.yyy&category_id=zzz RewriteRule ^([0-9a-zA-Z_-]+)/([0-9]+) $1.php?games_path=$1.swf&category_id=$2 [NC,L] ...


3

After some trys and searches I got it working using: RewriteCond %{DOCUMENT_ROOT}/$2 -f [OR] RewriteCond %{DOCUMENT_ROOT}/$2 -d RewriteRule ^([a-z]{2})/(.+)$ /$2 [L,QSA] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L]


2

I have: http://funkygames.co/games/achilles.php?games_path=achilles.swf&category_id=1 I want: http://funkygames.co/games/achilles/achilles/1 or even better: funkygames.co/games/achilles/1 (if that's possible) Try this: RewriteRule ^games/achilles/(.*)/([0-9]+)$ /games/achilles.php?games_path=$1.swf&category_id=$2 [NC,L] And if the game ...


2

Try this if you have rewrite module installed: RewriteEngine On RewriteCond %{REQUEST_URI} ^(.*)wp-login.php$ RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.xxx\.xxx$ RewriteRule ^(.*)$ - [R=403,L] replace the xxx's with each octet of your IP address. For example, if your IP address is 111.222.333.444, then replace RewriteCond %{REMOTE_ADDR} ...


2

Facebook would have been using the image URL as specified in the open graph tags. Since (by the sounds of it) the URL structure wasn't actually changed in WP (only in .htaccess) then this would have contained the /blog subdirectory in the URL. But then presumably you had to make an exception in .htaccess for the /blog/wp-content/uploads/ directory, or was FB ...


2

This answer comes from memory. If I'm 100% correct with the syntax, you'll want to replaced your 4 commented out lines of code with: RewriteCond %{REQUEST_URI} !^/en(.*)$ RewriteCond %{HTTP:Accept-Language} ^en [NC] RewriteRule ^$ https://www.example.com/en/ [L,R=301] RewriteCond %{REQUEST_URI} !^/it(.*)$ RewriteCond %{HTTP:Accept-Language} ^it [NC] ...


2

and I want my link to be: http://example.com/shaandaar/kinna_sona.html shaandaar and kinna_sona are the slugs in my database. What should I write in my .htaccess file? This is the best way: RewriteEngine On RewriteRule ^([^/]+)/([^/]+)\.html$ /video_in.php?firstslug=$1&secondslug=$2 [L] In the RewriteRule, the ^ starts the matching. This: ...


1

For the HTML files, you can't have it both ways. The only way for Varnish to always show HTML files if they've changed would be to check every time (=cache miss), at which point you've not gained anything by using it. If your site changes very frequently, setting a short cache time like you have is probably the best you can do (although 3 seconds might be a ...


1

As far as I know the proxy target in mod_rewrite is simply a front-end to mod_proxy and the ProxyPreserveHost is the only directive to configure that behaviour. So without access to the main server config or VirtualHost config your indeed without luck. You might be lucky and your old hosting provider may already resolve your site to the new ip-address; ...


1

The rewrite loop is actually caused by rules later in your script: RewriteRule ^(en|it)/(.*) $2?lang=$1 [QSA] RewriteRule ^([^/]+)$ index.php?op=$1 [L,NS,QSA] index.php Having redirected the user to /en/ (with the Accept-Language rules), the first directive here rewrites the request back to ?lang=en (no URL-path) but the second directive then fails to ...


1

If the query string is irrelevant then it can simply be ignored. (You can't match the query string anyway with the RewriteRule directive.) Try the following in your root .htaccess file to redirect the request: RewriteEngine On RewriteRule ^index.php/path/some-path/some-subpath$ /category/? [L,R=301] In per-directory .htaccess files, the URL-path matched ...


1

I tried doing this with a symlink, and it failed. After closetnoc also suggested I could use a symlink, I looked at it further. What worked was the following command (using SSH, at [~/public_html]#): mkdir blog mkdir /blog/wp-content ln -s ~/public_html/wp-content/uploads ~/public_html/blog/wp-content/uploads I would still like to know the correct way to ...


1

Have a look at my answer (on Drupal.SE) to the question "How to use the Rules module to implement a custom redirect for an outdated URL?". I bet the solution described there (using the Rules module) also works for this case. As detailed in that answer: the "clue" to get this to work, is to use the Rules Event "Drupal is initializing". That will ensure that ...


1

Solved it! It's important to use Alias and Require all granted in httpd.conf! The httpd.conf file: This is the configuration of the Apache Sever 2.4! #### Wikibase (BETA) <VirtualHost *> ServerName wikibase.isc ServerAlias wikibase.isc ServerAdmin SuriyaaKudoIsc@users.noreply.github.com DocumentRoot ...


1

When you encounter a 403 forbidden error it usually is a problem with directory permissions rather than with .htaccess files and rewrite rules. The first step is to check your servers error log. The error log often has more information in it than is presented to the user's web browser. The other thing to try is to check the directory permissions. Make ...



Only top voted, non community-wiki answers of a minimum length are eligible