1

I am really blank with htaccess system. My question is how to make a htaccess from domain1.com to domain1.com/1 ? Just in the same domain, not across domain. Because that number 1 is for a paging. My query limit doesn't show up without that number. Thank you for helping me.

I try this:

RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule ^ http://domain.com/1 [R=301,L]

but it doesn't worked

anubhava
  • 761,203
  • 64
  • 569
  • 643
Juna serbaserbi
  • 205
  • 2
  • 12
  • Possible duplicate of [Add Trailing Slash .htaccess](http://stackoverflow.com/questions/11829714/add-trailing-slash-htaccess) – Sergio Ivanuzzo Nov 03 '15 at 05:06
  • RewriteCond %{REQUEST_URI} !(/$|\.) RewriteRule (.*) %{REQUEST_URI}/1 [R=301,L] doesn't work for me to make domain.com to domain.com/1 – Juna serbaserbi Nov 03 '15 at 06:06

1 Answers1

1

You can just use this simple rule in your site root .htaccess:

RewriteEngine On

RewriteRule ^/?$ /1/ [R=301,L]

^/?$ matches landing page only.

anubhava
  • 761,203
  • 64
  • 569
  • 643
  • Still doesn't worked. I want if i type domain.com then directly change to domain.com/1, that's all @anubhava – Juna serbaserbi Nov 03 '15 at 06:32
  • after you said that then I saw at the top of .htaccess there are RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d , I deleted them both, then I change to RewriteRule ^/?$ /1 [R=301,L] , It's worked then. Thanks @anubhava for your solution, but I don't know what exactly of them ?, because they makes your code doesn't worked – Juna serbaserbi Nov 03 '15 at 06:51
  • `RewriteCond %{REQUEST_FILENAME} !-f ` means don't execute a rule if request is for a real file. `!-d` is for not a directory. Yes those conditions shouldn't be there to make it work. As landing page first resolves to a file like `index.html` or `index.php` – anubhava Nov 03 '15 at 06:57
  • 1
    I just guess @anubhava, fortunately correct, because I don't know anything about this htaccess system, must learn a lot about this issue. Thanks again for your explanations. – Juna serbaserbi Nov 03 '15 at 07:04
  • please help me again in [here](http://stackoverflow.com/questions/33669459/confusing-about-this-cookies-in-redirecting-system) – Juna serbaserbi Nov 12 '15 at 12:34