Category : mod-rewrite

With this .htaccess: RewriteEngine On RewriteRule foo/(.*) /foo-$1 # here I tried [L], [PT], [C], etc. RewriteRule . index.php [L] I’ve tried all possible flags for the first RewriteRule, but always, this PHP code: <?php echo $_SERVER[‘REQUEST_URI’]; ?> always echoes /foo/bar instead of /foo-bar, when accessing http://example.com/foo/bar. Why? How to have Apache’s RewriteEngine also modify ..

Read more

How do I write friendly urls htaccess? I feel like I’m all over the place trying to figure this out. RewriteEngine On RewriteBase / RewriteRule ^video-share/.*-([0-9]+)$ /video-share/$1.php [L] Redirect /404.html RewriteRule ^about$ about.html RewriteRule ^signin$ signin.php RewriteRule ^login$ login.php RewriteRule ^my-ads$ my-ads.php RewriteRule ^watch$ watch.php RewriteRule ^edit$ edit.php RewriteRule ^delete$ delete.php RewriteRule ^logout$ logout.php Source: ..

Read more

I have some RewriteRules in these formats: RewriteRule ^work/([a-zA-z0-9-]*).html$ work.php?go=$1 [L] RewriteRule ^work/([a-zA-z0-9-])/([a-zA-z0-9-]).html$ work.php?go=$1&sub=$2 [L] RewriteRule ^work/([a-zA-z0-9-])/([a-zA-z0-9-])/([a-zA-z0-9-]*).html$ work.php?go=$1&sub=$2&pid=$3 [L] RewriteRule ^work/([a-zA-z0-9-])/([a-zA-z0-9-])/([a-zA-z0-9-])/([a-zA-z0-9-]).html$ work.php?go=$1&sub=$2&pid=$3&pad=$4 [L] RewriteRule ^work/([a-zA-z0-9-])/([a-zA-z0-9-])/([a-zA-z0-9-])/([a-zA-z0-9-])/([a-zA-z0-9-]*).html$ work.php?go=$1&sub=$2&pid=$3&pad=$4&id=$5 [L] All works fine. But has anyone an idea, how I can put all this line in only one line as only one rule? Sourc..

Read more

So I have a page called "watch now" located at /watch-now/ and when there are parameters added (v= and h=) the template pulls in a video and headline. My goal was to create a URL based on these parameters. For example: https://www.example.com/watch-now/?v=https://externalhere.wistia.com/medias/kjkeskevwx&h=The%20Title%20Here Therefore my query vars are as follows (using $_GET in the template file ..

Read more

What would be the best way to redirect different domains hosted on the same server to a corresponding uri? Example: http://domain1.com to http://domain1.com/index.php/domain1/index http://domain2.com to http://domain2.com/index.php/domain2/index http://domain3.com to http://domain3.com/index.php/domain3/index Virtual hosts are not an option since I don’t have a DocumentRoot /var/www/vhosts/site1/ or Directory /var/www/vhosts/site1/ The httpd.conf is minimal since everything is handled via php ..

Read more

Website 1 : example.com Website 2 : example.com/product – WordPress hosted on a separate machine NGINX setting on a different machine used for reverse proxy – server { listen 443 ssl; server_name example.com; ssl on; location / { proxy_pass https://10.110.7.5:1100; } location /product/ { proxy_pass http://10.110.5.20/; } } .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / ..

Read more